CIS 421Flash> Layers in Timeline

Play XML list of videos

Text Types in Flash

There are 3 kinds of text that you can define in a SWF movie. Two are used in this one. With the text tool or the text itself selected, you define the type of text in the upper left dropdown in the property inspector,

  • Static text does not change while the movie runs. It is used for titles, directions, etc.
  • Input text is used for input boxes, to let the user type in choices that can be used by the SWF movie or passed to a database
  • Dynamic text is text that can change as the movie runs its course. In this movie it displays information from the XML file, based on the movie that is playing.

Set up new FLA document

  1. Create a new directory FLV to hold all of the pieces required by this SWF movie.
  2. New> FLA document ActionScript 3.0, & save as XMLplay.fla in FLV folder
  3. Document settings: size minimum: 560x400, background color of your choice
  4. Save as XMLplay.fla
  5. Save the FLV movies that you want to play in the same directory

Insert Video Playback component

  1. Windows>Components to open components panel
  2. Click on the Video group to open it
  3. Drag an instance of the first component FLVPlayback onto the stage at the left
  4. Give it the instance name of vidPlayback in its property inspector
  5. Use the Parameters tab on the Property Inspector panel or open the Component inspector (Windows>Components Inspector).
  6. Select a skin with captioning such as SkinUnderPlayStopSeekCaptionVol.swf and select the color for the controls.
  7. Leave autoPlay to
    1. true if you want each video to begin playing after it loads
    2. to false if you want it to wait for the viewer to press the play button to start it
  8. This movie automatically plays each video on the list, one after the other. If you set autoPlay to false, the movies will be stopped when you select one from the list

Modify XML Playlist

  1. Download a copy of the videos.xml file.
  2. Change the names, title, and descriptions to the FLV files you want to display.
  3. Delete any extra instances of the <video> tags
  4. Save a copy of your version of the videos.xml file in the same folder as your Flash fla file (you will need to upload it to the server).
  5. this XML file contains information about each FLV file that will be loaded into the FLV component vidPlayback in your SWF movie
    <video url="cuepoints.flv" title="video with cuepoints" description="video with cuepoints." />
  6. The attributes of each instance inside the <video> tag includes the
    1. url: the name & path of the FLV file
    2. title: the title you want displayed in the list of choices of FLV files
    3. description: the description of the video that will display in a dynamic textbox when the video is playing.
  7. NOTE: The SWF file will list however many FLV videos are listed in the XML file and add vertical scrollbars, if necessary.
  8. If you want to add or subtract the number of movies (<video> records) in the XML file, you need to:
    1. Add or subtract <video> records in the XML file
    2. Change the number in line 40 of the ActionScript fileto 1 less than the number of <video> records, since the index in the routine that loops through them starts at 0 --
      The video list loops back to the top when it has automatically played 1 less than the number in this statement
      This line 40 statement loops through 4 <video> records
      if (flvList.selectedIndex == 3) {
      This line 40 statement loops through 3 <video> records:
      if (flvList.selectedIndex == 2) {
    3. If you change the XML file & ActionScript files after you have compiled the SWF file, you will have to open it in Flash and recompress the SWF filet
    4. If you add more selections to the XML file, then the SWF file will then add scrollbars to the list of video selections so user can scroll down to view them

Static text title

  1. Select the text tool
  2. Type "Choose from the following videos" or something similar at the top right of the stage.
  3. In the property inspector, make sure Static Text is selected in the top left dropdown.
  4. Static text is used for text that does not change while the movie plays.

movieclip to list Videos

  1. Import the component library necessary to read the xml file and create the list of videos from the xml file:
    1. Download listlibrary.fla to the same folder as your fla file
    2. File>Import>Open external library>listlibrary.fla opens the library which contains the list movieclip and the component assets you need to use.
  2. Drag the List movieclip from this library onto the upper right stage
  3. In the property inspector:
    1. give it the instance name flvList
    2. change its width to 190 and its height to 125

Dynamic text field to display movie description

  1. A dynamic text field can hold text that is generated by the movie as it runs. As each movie plays its description is displayed from the xml file
  2. Click on the text tool
  3. Drag it onto the stage below the list movieclip
  4. In the Property Inspector
    1. Give it the instance name descText
    2. Change its width and height properties to about 190x200, so it matches the list movieclip

ActionScript to run the movie

  1. This movie uses an external ActionScript file to run the movie.
  2. Download FLVPlayList.as and save it in the same directory as your fla file.
  3. In the movie scene, deselect everything by clicking off the stage area.
  4. Type FLVPlayList in the Document Class input box at the lower right of the property inspector.
  5. Save your movie and test it to see if it works.
  6. If it doesn't work, look at the compiler errors. If you click on the error it will show you where the ActionScript error occurs.
  7. Usually it is because of instance names or missing FLV files, so you need to check those first

Sample movie