Bundled device video example

This section shows you how to create an application that plays a bundled device video file. To do this, you'll first import a device video into your Flash document (see Importing device video), create an instance of the video on the Stage, and finally add ActionScript to play and stop the video.

You can also play video directly from the library. For more information, see Playing a bundled video directly from the library.

To import and play a bundled device video:

  1. In Flash Professional 8, create a new document from the Flash Lite 2.0 Symbian Series 60 template, and save it as bundled_video.fla.
  2. Import the device video file named ocean.3gp located in the Samples and Tutorials/Samples/Flash Lite 2.0/Video/ folder in the Flash Professional 8 installation folder on your hard disk.

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

    A new video symbol appears in the Library panel.



  3. In the Timeline, select the layer named Content, then drag an instance of the video symbol in the Library panel to the Stage.
  4. Select the video object on the Stage and, in the Property inspector, type myVideo in the Instance Name text box.

    This is the name you will use to refer to the video object in ActionScript code.



  5. In the Property inspector, set the video object's width to 176 and its height to 144.

    These dimensions match those of the source video. Depending on the device, a device video in Flash Lite does not always scale to fit the size of the video object's bounding box. For more information, see Limitations of device video.

  6. To add buttons to control the video, open the library of prebuilt buttons (Window > Common Libraries > Buttons).
  7. In the Buttons library, double-click the Circle Buttons folder to open it.
  8. Drag an instance of the Play button symbol from the Buttons library to the Stage.
  9. Drag an instance of the Stop button symbol from the Buttons library to the Stage.
  10. Select the Play button on the Stage and open the Actions panel (Window > Actions).
  11. Type (or copy and paste) the following code into the Actions panel:
    on(press) {
        myVideo.play();
    }
    
  12. Select the Stop button on the Stage and type the following code in the Actions panel:
    on(press) {
        myVideo.stop();
    }
    
  13. Publish the SWF file (File > Publish) and transfer it to your device for testing.

    NOTE

     

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