Playing a bundled video directly from the library

Earlier in this document (see Using bundled device video) you learned how to import and play a single bundled device video. To do this, you imported the device video into the library, added an instance of the video symbol to the Stage, and called the Video.play() method on the video instance.

You can also use a single Video object on the Stage to play multiple bundled device videos directly from the library. To do this, you bundle the device video in your application's library. You also assign an identifier to the video symbol that lets you reference the video symbol with ActionScript, as the following image shows:



You then create another placeholder video symbol and add an instance of it to the Stage. To use the placeholder video to play the device video in the library, you pass the symbol's ActionScript identifier to the Video.play() method, as the following example shows:

placeHolderVideo.play("symbol://ocean_video");

The following procedure demonstrates how to use this technique to play a single video directly from the library.

To play a video directly from the library:

  1. In Flash Professional 8, create a new document from the Flash Lite 2.0 Symbian Series 60 template, and save it as library_video.fla.
  2. Import the video file named ocean.3gp located in the /samples/video/ folder.

    For more information about importing device video, see Importing device video.

  3. Right-click (Windows) or Control-click (Macintosh) the ocean.3gp video symbol in the library and choose Properties from the context menu. The Video Properties dialog box appears.
  4. In the Video Properties dialog box, select Export for ActionScript and type ocean_video in the Identifier text box, as the following image shows:



  5. Click OK to close the Video Properties dialog box.
  6. To create the placeholder video clip, do the following:
    1. In the Library panel, click the options menu button in the panel's title bar and select New Video. The Video Properties dialog box appears.
    2. In the Symbol text box, type videoHolder.



    3. Click OK to close the Video Properties dialog box.
  7. In the Timeline, select the layer named Content, then drag an instance of the videoHolder symbol to the Stage.
  8. In the Property inspector, type myVideo in the Instance Name text box.
  9. To add buttons to control the video, open the library of prebuilt buttons (Window > Common Libraries > Buttons).
  10. In the Buttons library, double-click the Circle Buttons folder to open it.
  11. Drag an instance of the Play button symbol from the Buttons library to the Stage.
  12. Drag an instance of the Stop button symbol from the Buttons library to the Stage.
  13. Select the Play button on the Stage and open the Actions panel (Window > Actions).
  14. Type (or copy and paste) the following code into the Actions panel:
    on(press) {
        myVideo.play("symbol://ocean_video");
    }
    
  15. Select the Stop button on the Stage and type the following code in the Actions panel:
    on(press) {
        myVideo.stop();
    }
    
  16. Publish the SWF file (File > Publish) and transfer it to your device for testing.

    NOTE

     

    You must test device video on the actual device; you can't preview it in the emulator.