【发布时间】:2011-05-24 17:19:06
【问题描述】:
尝试学习一些 Flash 并得到一个问题。如何播放 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
}
感谢您的帮助。
【问题讨论】:
标签: flash mxml flv flashdevelop flvplayback