Tuesday, April 29, 2008

FLVPlayback in Flex ActionScript Project

If you create an AS3 project in Flex you will not have access to the FLVPlayback component by default. You could always try to use the Video class and a NetStream, but what if you want to add in cue points dynamically? The netStream will only send cueEvents, it does not have an API to add new ones.

Therefore you are going to need to add two things to your project in order for you to use the FLVPlayback component.

1. Open your project properties and click on ActionScript Build Path. While in the "Source path" tab, click on add Folder. Add the following folder:
Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\FLVPlayback

That will at least allow you to import the playback class, but it still will not compile without adding the swc library.

2. Open your project properties and click on ActionScript Build Path. Click on the "Library path" tab. Click "Add SWC" on the right. Add the following swc file:
C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Components\Video\FLVPlaybackAS3.swc

Now all you have to do is import the class into your as file: import fl.video.FLVPlayback; and you are good to go.

1 comment:

Anonymous said...

Cool. Thank you.