ActionScript 2: Create dynamic FLVPlaybacks with attachMovie

There is a simple way in ActionScript 2 to dynamically create instances of the FLVPlayback component:

  1. Put the FLVPlayback component into your library (you can drag’n'drop the component from the components window into the library).
  2. Use the following two lines of code to attach the FLVPlayback to a MovieClip (_root in the simple example) and to set the path to the flv to play:
    _root.attachMovie("FLVPlayback", "myFLVPlayback", _root.getNextHighestDepth());
    myFLVPlayback.contentPath = "video.flv";

The id of the FLVPlayback in the library needs to be “FLVPlayback” (case sensitive).

A running example (Flash CS3) can be found here.

Related posts:

  1. ActionScript 2: Create dynamic text fields with Arabic texts
  2. ActionScript 2: Bugfixes in “ActionScript 2.0 Arabic Parsing v1.2”
  3. ActionScript 2: Copy MovieClips with BitmapData on runtime
  4. ActionScript 2: Cast object to array
  5. ActionScript 2: Bugfixes in “ActionScript 2.0 Arabic Parsing v1.2” – Part 2

Leave a comment

Your email address will not be published. Required fields are marked *

*

*