There is a simple way in ActionScript 2 to dynamically create instances of the FLVPlayback component:
- Put the FLVPlayback component into your library (you can drag’n'drop the component from the components window into the library).
- 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.