开发者

Using FLVPlayBack in FlashDevelop

Trying to learn some flash and got a question. How do I play a flv video, below code compiles correctly and load flash player but doesn't play anything

            var vid:FLVPlayback = new FLVPlayback();
            var ui:UIComponent = new UIComponent();
            this.addChild( ui );
            ui.addChild( vid );
                vid.width = 320;                
            vid.height = 240;
            vid.source = "http://www.helpexamples.com/flash/video/caption_video.flv";
            vid.skinBackgroundColor = 0x666666;
            vid.skin = "SkinUnderPlaySeekMute.swf";
            vid.addEventListener(VideoEvent.STATE_CHANGE , onCreationComplete);

        private function onCreationComplete():void
        {

            vid.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
            vid.skinAutoHide = false;

        }
    ]]>
</mx:Script>
</mx:Application>

Do I need to call a load method on vid ? Appreciate any help.

EDIT: I changed the code as below and it works fine.

import fl.video.*;
import fl.video.VideoEve开发者_高级运维nt;
import flash.events.MouseEvent;
var flvPlayer:FLVPlayback = new FLVPlayback();

addChild(flvPlayer);
flvPlayer.addEventListener(MouseEvent.CLICK, onCreationComplete);

flvPlayer.skin = "./SkinUnderPlaySeekMute.swf";

flvPlayer.source = "http://www.helpexamples.com/flash/video/water.flv";

// on the event of mouose click, 
function onCreationComplete(eventObj:MouseEvent):void
{                  
   // do some stuff         
 }

Thanks for your help.


I don't see you telling it to play anywhere.

vid.play();

You can also set autoplay to true;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜