Developing Flash Lite 2.x and 3.0 Applications

Controlling Flash Video with ActionScript

To control the playback of external Flash Video files at runtime, use the NetConnection and NetStream ActionScript classes. You use the NetConnection class to establish a connection, and then use the NetStream object to play back streaming video (FLV) files either locally or from a server.

Loading Flash Video using the NetStream and NetConnection classes is a multistep process.

  1. The first step is to create a NetConnection object. The NetConnection class lets you play streaming FLV files from either an HTTP address or a local drive by passing the value null to the connect() method if you are connecting to a local FLV file that is not using a server.
  2. The second step is to create a NetStream object which takes a NetConnection object as a parameter and specify which FLV file you want to load.
  3. The third step is to create a new Video object and attach the previously created NetStream object using the Video class's attachVideo() method.

See the Flash Lite 2.x and 3.0 ActionScript Language Reference for detailed descriptions of these classes, along with code examples that illustrate their use.