在 FlashDevelop 中使用 FLVPlayBack
尝试学习一些 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 上调用加载方法吗?感谢任何帮助。
编辑:我更改了代码,如下所示,它工作正常。
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
}
感谢您的帮助。
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.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
}
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有看到你告诉它在任何地方播放。
您还可以将自动播放设置为true;
I don't see you telling it to play anywhere.
You can also set autoplay to true;