As the Flash Lite Player does not have to play the video, creating a player application in Flash IDE is a simple process. First, create a blank SWF file by following the instructions in section Building and running your first Flash Lite application. You can set the resolution of your Flash Lite movie to 240x320px or 288x352px depending on your device. Both resolutions are widely used.
Add a video object to the SWF file by selecting New Video from the top right corner of the library panel.
Name the symbol as MyVideo and make
sure that option Video (ActionScript-controlled) is selected.
You can then bundle the video file with the SWF movie by checking the Bundle
source in SWF for mobile and devices and Export for ActionScript boxes.
Give the video an identifier (VideoExample) and choose
the correct file to be included in the SWF movie by clicking Import and
selecting the clock.3gp video file.
Drag an instance of the MyVideo object
on to the top of the working area.
Create a Dynamic Text Field below the Video Object and name
it as video_txt. This text field informs the user about
the state of the video that is currently playing.
Add the following code in the first frame of the movie:
fscommand2("FullScreen", false); fscommand2("SetSoftKeys", "Start", "Quit"); player.onKeyDown = function() { switch (Key.getCode()) { case ExtendedKey.SOFT1 : video_txt.text = "Playing"; player.play("symbol://VideoExample"); break; case Key.UP : video_txt.text = "Playing"; player.resume(); break; case Key.DOWN : video_txt.text = "Paused"; player.pause(); break; case Key.ENTER : video_txt.text = "Stopped"; player.close(); break; case ExtendedKey.SOFT2 : fscommand2("quit"); break; } } Key.addListener(player);
This snippet of ActionScript sets the movie to avoid the fullscreen mode as the video player size is low enough to fit on screen even without fullscreen mode set. This way the softkey labels are also drawn automatically.
The rest of the code assigns the left softkey to start playing the movie
that has the identifier VideoExample. If you changed
the name of the identifier, you need to edit it in the code as well. The up
and down keys resume and stop the movie, and Selection key stops it completely. close() function
is used instead of stop() as it both stops the playback
and frees the memory associated with the current video object. The right softkey
exits the application.
Flash Player 2.x allows using an object
such as the player Video Object as a key listener, so
there is no need to create a separate object for that purpose.
Publish your SWF movie. The clock.3gp video
file is included in it and the file size of the SWF file reflects this. After
publishing, transfer both files to your mobile device. For instructions on
deploying the files, see section Deploying
Flash Lite applications.
Note: The video clip may not display in the emulator unless you download and install QuickTime