The following example shows how you can dynamically attach a Flash ActionScript 3.0 FLVPlayback component onto the stage at runtime.
Full time after the jump.
// ActionScript 3.0 /* Requires * - FLVPlayback control in Flash library * - SkinOverPlaySeekMute.swf file in the same directory as the Flash document */ import fl.video.FLVPlayback; var flvPlayback:FLVPlayback = new FLVPlayback(); flvPlayback.autoPlay = false; flvPlayback.source = "http://www.helpexamples.com/flash/video/cuepoints.flv"; flvPlayback.skin = "SkinOverPlaySeekMute.swf"; flvPlayback.x = 10; flvPlayback.y = 10; addChild(flvPlayback); |
4 Responses to Dynamically creating new FLVPlayback control instance in Flash using ActionScript 3.0
Leave a Reply Cancel reply
Recent Posts
- Getting started with the TLFTextField class in ActionScript 3.0 and Flash CS5
- Adding tick marks to a Slider control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Creating a custom context menu item in Flash using ActionScript 3.0
- Rotating a Sprite object around its x-axis in Flash using ActionScript 3.0 and Flash Player 10
- Detecting when the user changes the color in a ColorPicker control in Flash using ActionScript 3.0
- Getting the currently selected color as a hexadecimal value on a ColorPicker control in Flash using ActionScript 3.0
- Toggling the text field on the ColorPicker control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Setting the number of columns on a ColorPicker control in Flash using ActionScript 3.0
Categories
- Bitmap (1)
- Components (72)
- Button (19)
- CheckBox (2)
- ColorPicker (6)
- ComboBox (1)
- DataGrid (8)
- FLVPlayback (7)
- Label (9)
- ProgressBar (2)
- Slider (3)
- TextArea (1)
- TextInput (7)
- UILoader (7)
- ContextMenu (1)
- Embed (4)
- ExternalInterface (2)
- Flex (7)
- Font (2)
- General (5)
- Graphics (2)
- JSFL (14)
- Loader (3)
- LoadVars (3)
- Microphone (1)
- migration (12)
- MovieClip (1)
- MovieClipLoader (1)
- Sound (2)
- TextField (1)
- TLFTextField (1)
- TransitionManager (1)
- Tween (1)
- Uncategorized (1)
- URLLoader (4)
- URLVariables (1)
- Video (1)
- XML (2)
Advertising
"No public Twitter messages." — pdehaan


Hi Peter!
I’m trying to add a FLVPlayback with an AS3 package (using an instance) to the stage through addChild , but I’m having trouble because the video doesn’t show up, I only can hear the sound. I try setting the “View all” option, but nothing appears, just the sound.
Any idea?? Thanks for the post, for your time and for your response.
Beto
Hi Peter! I’m here again… I can say that I “fix” my mistake.
The problem was that I was adding the FLVPlayback component to the stage without adding the instance that was containing it.
So, adding an instance to the stage means almost nothing if there’s an instance wrapping it that wasn’t previously added to stage. (espero que mi inglés se deje entender)
Thanks again,
Beto
I did just that and it works fine until I tried to removed on the next action.
Do you have any idea how it’s done?
When I remove it gives me this on the output: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at index_fla::MainTimeline/cos()
The function I’m using to remove it is:
function cos(event):void {
removeChild(myFLVPlayback);
}
The child is not on the stage. Wrapping it inside an if statement checking if the instance has a reference to the stage makes it throw no error, in case it’s not on the stage:
if(myFLVPlayback.stage) { removeChild(myFLVPlayback); }
Hope it helps!