试图学习一些闪光并得到一个问题。如何播放 flv 视频,下面的代码正确编译并加载 Flash 播放器,但不播放任何内容
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>
我需要在 vid 上调用 load 方法吗?感谢任何帮助。
编辑:我改变了代码如下,它工作正常。
import fl.video.*;
import fl.video.VideoEvent;
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
}
谢谢你的帮助。