在 FlashDevelop 中使用 FLVPlayBack

发布于 2024-11-09 14:50:20 字数 1472 浏览 6 评论 0原文

尝试学习一些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷爱 2024-11-16 14:50:20

我没有看到你告诉它在任何地方播放。

vid.play();

您还可以将自动播放设置为true;

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

vid.play();

You can also set autoplay to true;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文