Adding an FLVPlayback component at run time
Here's a neat little trick... how would you like to load up and run the FLVPlayback component at run time? That means the component isn't on the stage. Here's how:
import fl.video.FLVPlayback;
var myVideo.FLVPlayback = new FLVPlayback();
myVideo.skin = "SkinUnderAll.swf";
myVideo.skinBackgroundColor = 0x999999;
myVideo.source = "myFLV.flv";
myVideo.x = 100;
myVideo.y = 100;
addChild(myVideo);
This isn't terribly difficult to follow.
You import the FLVPlayback class into the movie. You next create an instance of the component - myVideo - and give it a skin, skin color and a source. All of these follow the parameters you would use if you were to have the component on the stage. Just keep in mind you will have to copy the SkinOverAll.swf file to the same folder as the FLA and the FLV. The skins can be found in the Flash folder on your hard drive.
Always copy the skin and paste it into its new location. Moving the swf from the application folder to another folder results in your losing the access to that particular skin.
You then give your instance its stage coordinates and then use the addChild() method to get the component on to the stage from the Library.
- Open a new Flash CS3 document and save it to the same folder as the FLV you will using.
- Drag a copy of the FLVPlayback component to the Library. Alternatively you can add it to the stage and immediately delete it from the stage.
- Select the first layer and rename it Actions.
- Click once in the first frame of the Actions layer and open the Actions panel.
- Add the following code:
import fl.video.FLVPlayback;
var myVideo.FLVPlayback = new FLVPlayback();
myVideo.skin = "SkinUnderAll.swf";
myVideo.skinBackgroundColor = 0x999999;
myVideo.source = "myFLV.flv";
myVideo.x = 100;
myVideo.y = 100;
addChild(myVideo);
This isn't terribly difficult to follow.
You import the FLVPlayback class into the movie. You next create an instance of the component - myVideo - and give it a skin, skin color and a source. All of these follow the parameters you would use if you were to have the component on the stage. Just keep in mind you will have to copy the SkinOverAll.swf file to the same folder as the FLA and the FLV. The skins can be found in the Flash folder on your hard drive.
Always copy the skin and paste it into its new location. Moving the swf from the application folder to another folder results in your losing the access to that particular skin.
You then give your instance its stage coordinates and then use the addChild() method to get the component on to the stage from the Library.

3 Comments:
Dear Mr. Green:
I'm very impressed with your site and am looking for other sites/forums dedicated to flash developers. Do you have a list of your favorite sites or know where I might find one on the web?
Just do a search on google.
This site contains valuable info
on both Flash and FLV (Video).
oops..I forgot to paste the URL.
www.flashcomguru.com
Post a Comment
<< Home