Using the Flash FLVPlayback control in Flex

by Peter deHaan on December 11, 2008

in FLVPlayback, Flash, Flash Integration, UIComponent

The following example shows how you can use the Flash FLVPlayback component that ships with Flash CS3 and Flash CS4 by copying the FLVPlaybackAS3.swc file into your Flex project’s /libs/ folder.

Full code after the jump.

Flash CS3
PC: \Adobe Flash CS3\en\Configuration\Components\Video\FLVPlaybackAS3.swc

Flash CS4
PC: \Adobe Flash CS4\Common\Configuration\Components\Video\FLVPlaybackAS3.swc

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/12/11/using-the-flash-flvplayback-control-in-flex/ -->
<mx:Application name="FLVPlayback_MXML_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:video="fl.video.*"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            private function flvPlayback_autoLayout(evt:Event):void {
                videoHolder.width = flvPlayback.width;
                videoHolder.height = flvPlayback.height;
                flvPlayback.x = 0;
                flvPlayback.y = 0;
            }
        ]]>
    </mx:Script>

    <video:FLVPlayback id="flvPlayback"
            source="http://www.helpexamples.com/flash/video/caption_video.flv"
            scaleMode="maintainAspectRatio"
            skin="SkinOverPlaySeekMute.swf"
            skinAutoHide="true"
            autoLayout="flvPlayback_autoLayout(event);" />

    <mx:ApplicationControlBar dock="true">
        <mx:Button id="btn"
                label="Play Video"
                click="videoHolder.addChild(flvPlayback);" />
    </mx:ApplicationControlBar>

    <mx:Panel backgroundColor="red">
        <mx:UIComponent id="videoHolder" />
    </mx:Panel>

</mx:Application>

{ 8 comments… read them below or add one }

1 vijay December 12, 2008 at 3:04 am

thanks a lot……………
Its useful to my work.

by
VJN

Reply

2 James December 12, 2008 at 8:16 am

We were muttering about the lack of components for flv playback in Flex only this morning. Hopefully this will solve our woes – thanks!

Reply

3 MechanisM December 13, 2008 at 4:32 pm

Thanxx Peter!! Its very useful for me!!

Reply

4 cris December 16, 2008 at 2:32 pm

estou estudando flash cs4

Reply

5 eChicho February 7, 2009 at 7:19 am

Muchas gracias, me ha ayudado mucho. (Thanks, help me so much)

Reply

6 Guri May 21, 2009 at 2:45 am

Extremly utilitarian! Thanks

Reply

7 Rhoby May 23, 2009 at 3:34 am

Merci beaucoup!!
As usual, very useful tips on this site!!!
thx a lot Peter !!!!

Reply

8 bingeboy June 30, 2009 at 10:41 pm

Hi I’m very new to flex and I’ve been working with your examples and they have a been a big help.

I’m having an issue adding the FLVPlaybackAS3.swc to the lib folder. I’m using Textmate on OSX to complete my swf files and I can’t seem to sort out where I put this file to the code will compile correctly. Any help on this would be great.

Thanks

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: