Flash - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Flash

Description:

headline France loses to Senegal /headline ... Flash: Moving photos. http://newmedia.purchase. ... Use the on-line help to add the headline under any photos. ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 23
Provided by: jeanin7
Category:
Tags: flash

less

Transcript and Presenter's Notes

Title: Flash


1
Flash XML
  • (Review midterm)
  • JavaScript to use xml xsl with parameters
  • Flash XML
  • Presentations

2
Midterm
  • Contacts
  • bedtime song
  • All
  • What are reasons to use xml and xsl to produce a
    web site? What are reasons NOT to use xml and
    xsl?
  • What are the factors making an HTML site an XHTML
    site. To put it another way, what do you have to
    check and, possibly, modify?
  • Give reasons pro and con for using graphical
    icons in interfaces.
  • bbc and purchase sites.

3
Parameter example
  • Use fixed xml and xsl. The xsl makes use of a
    parameter
  • IE and Mozilla implementations plus combined
    implementation
  • try and catch construct
  • SEE notes online with other xmlstuff

4
Flash XML
  • Flash can open and 'use' an XML file on the
    server
  • and create/modify and XML document and send it
    back to server.
  • Action is asynchronous does not happen
    instantly. Your code sets up the handler for when
    loading is done.
  • There is a XML Document Object Model that defines
    the objects, properties and methods.
  • Caution test for tags by name. Extra tags
    (arising from white space) will be part of
    document.
  • Caution the content of a tag is its first child.

5
  • lt?xml version"1.0" ?gt
  • ltmylistgt
  • ltcontactgt
  • ltnamegtMarty Lewinterlt/namegt
  • ltemailgtmathman_at_purchase.edult/emailgt
  • lt/contactgt
  • ltcontactgt
  • ltnamegtPeter Ohringlt/namegt
  • ltemailgtpeter.ohring_at_purchase.edult/emailgt
  • lt/contactgt
  • ltcontactgt
  • ltnamegtJoe Skirvanek lt/namegt
  • ltemailgtjoes_at_purvid.purchase.edu lt/emailgt
  • lt/contactgt
  • ltcontactgt
  • ltnamegtJoel Tenenbaumlt/namegt
  • ltemailgtjoel_at_zephyr.ns.purchase.edult/emailgt
  • lt/contactgt
  • lt/mylistgt

6
ActionScript
function to be defined next.
  • contactXMLnew XML()
  • contactXML.onLoadtransXML
  • display1"loading data"
  • contactXML.load("contacts.xml")

Dynamic text field.
7
  • function transXML()
  • if (this.loaded)
  • display1 "XML data is loaded."
  • keyTag new XML()
  • contactList new Array()
  • keyTagthis.lastChild
  • contactList keyTag.childNodes
  • contactdata new Array()
  • display ""

lastChild is first child is mylist
Another dynamic textfield
8
  • for (kid 0 kidltcontactList.length kid 1)
  • contactdata contactListkid.childNodes
  • for (i0 iltcontactdata.length i)
  • if (contactdatai.nodeName"name")
  • display display newline contactdatai.firs
    tchild.nodeValue
  • if (contactdatai.nodeName"email")
  • display displaynewline
    contactdatai.firstchild.nodeValue
  • display display newline

the contents (text) of each node
9
(No Transcript)
10
2nd Example soccer results
  • Similar to first reading in data from XML
  • duplicateMovieClip to create places to loadMovie
    the jpg image files
  • create an empty movie clip symbol and one
    instance of it off stage. It is named 'place'.
  • position duplicate movie clips on stage by
    setting properties _x and _y of (duplicated)
    Movie clips.

11
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltresults group"A"gt
  • ltmatch feature"no"gt
  • ltdategt07-Jun-2002 lt/dategt
  • ltteam score"3"gtSpain lt/teamgt
  • ltteam score"1"gtParaguay lt/teamgt
  • lt/matchgt
  • ltmatch feature"yes"gt
  • ltdategt31-May-2002 lt/dategt
  • ltheadlinegtFrance loses to Senegal lt/headlinegt
  • ltstorygtThe 1998 World Cup Champion France lost
    the opening game to Senegal. It was
  • Senegal's first appearance in a World Cup. This
    was a stunning upset for France. The
  • team was playing without one of the stars,
    Zidane. lt/storygt
  • ltteam score"1"gtSenegal lt/teamgt
  • ltteam score"0"gtFrance lt/teamgt
  • ltpicturegtsoccer1.jpg lt/picturegt
  • lt/matchgt

12
(No Transcript)
13
Similar start of ActionScript
  • resultsXMLnew XML()
  • resultsXML.onLoadtransXML
  • display1"getting data"
  • resultsXML.load("resultsnoref.xml")

14
Similar start of transXML()
  • function transXML()
  • if (this.loaded)
  • display1 "XML data is loaded."
  • keyTag new XML()
  • matchList new Array()
  • keyTagthis.lastChild
  • matchList keyTag.childNodes
  • matchdata new Array()
  • ccount 0
  • nump 0
  • display ""

will be used for any pictures.
15
  • for (m 0 mltmatchList.length m 1)
  • if (matchListm.nodeName"match")
  • ccount
  • matchdata matchListm.childNodes
  • for (i0 iltmatchdata.length i)
  • if (matchdatai.nodeName"team")
  • display display newline
    matchdatai.firstchild.nodeValue
  • display display" "matchdatai.attribute
    s"score"

16
  • if (matchdatai.nodeName"picture")
  • nump
  • newp "place"nump
  • duplicateMovieClip(place,newp,nump)
  • setProperty(newp,_x,400)
  • setProperty(newp,_y,10 200(nump-1))
  • loadMovie(matchdatai.firstchild.nodeValue,newp
    )
  • display display newline
  • display1"Number of matches " ccount

incremented for each picture
17
Flash Moving photos
  • http//newmedia.purchase.edu/Jeanine/interfaces/x
    mlstuff.html
  • choose xmlfamily.html
  • Building on previous examples
  • reads in name, picture file name, and speed
  • creates arrays, including arrays of movie
    instances holding pictures
  • Looping using frames, move instances by the
    corresponding speed

18
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltscenesgt
  • ltscenegt
  • ltnamegtWinter Piano Party Esther and Avivalt/namegt
  • ltpicturegtavivagrandma.jpglt/picturegt
  • ltspeedgt6lt/speedgt
  • lt/scenegt
  • ltscenegt
  • ltnamegtUday with Amy and her sisterslt/namegt
  • ltpicturegtsisters.jpglt/picturegt
  • ltspeedgt10lt/speedgt
  • lt/scenegt
  • lt/scenesgt

19
  • for (i0 iltmatchdata.length i)
  • if (matchdatai.nodeName"picture")
  • nump
  • newp "place"nump
  • duplicateMovieClip(place,newp,nump)
  • setProperty(newp,_y,1060(nump))
  • setProperty(newp,_x,200(nump-1))
  • loadMovie(matchdatai.firstchild.nodeValue,ne
    wp)
  • stuff.Push(_rootnewp)
  • if (matchdatai.nodeName"speed")
  • speeds.Push(Number(matchdatai.firstchild.nodeVa
    lue))
  • if (matchdatai.nodeName"name")
  • names.Push(matchdatai.firstchild.nodeValue)

20
frame looping
  • for (i0 iltstuff.length i)
  • stuffi._x stuffi._xspeedsi
  • if (stuffi._xgtrightbound)
  • speedsi-speedsi
  • if (stuffi._xltleftbound)
  • speedsi-speedsi
  • gotoAndPlay("loop")

21
Flash exercise
  • Optional (if you know some Flash and want to use
    it for your projects)
  • Get this example running. Improve graphics.
  • Use the on-line help to add the headline under
    any photos.
  • create a set number of dynamic text fields and
    limit pictures to that many.
  • re-position text fields near pictures.

22
Lab time
  • Presentations
Write a Comment
User Comments (0)
About PowerShow.com