Actionscript 按钮点击 Flv 视频帮助

发布于 2024-11-18 17:25:10 字数 162 浏览 5 评论 0原文

我是动作脚本的新手,不知道如何做到这一点。

我有一个名为 btnPlay 的按钮和一个名为 valerie.flv 的 flv 视频 我希望当按下按钮时,flv 视频通过标准 flv 播放器在同一个 flash 文件中播放。

我尽了一切努力,但我就是不知道。我非常感谢您的帮助。

I'm new at actionscript and not sure how to do this.

I have a button named btnPlay and an flv video named valerie.flv
I would like it when the button is pressed, the flv video plays in the same flash file through the standard flv player.

I tried everything I could and I just have no idea. I would really appreciate the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

烟雨扶苏 2024-11-25 17:25:10

AS3 解决方案:

这一切都发生在时间轴中的一帧上。

  1. 组件面板>视频> FLV 播放 <-- 将此组件拖到舞台上

  2. 在“组件检查器”面板中,选择 flv 播放实例,设置:

    • 来源:valerie.flv(这是一个相对 html 路径,仅当 flv 与 html 和 swfs 位于同一文件夹中时才有效)
    • 自动播放:假
  3. 然后,选择 flv 播放实例,在“属性”面板中设置:

    • myVideo 作为实例名称
  4. “组件面板”>用户界面>按钮 <-- 拖到舞台上

  5. 选择按钮实例后,在“属性”面板中设置:

    • myButton 作为实例名称
  6. 在“组件检查器”面板中,选择按钮实例后,设置:

    • 标签:播放视频
  7. 选择这两个组件所在的框架,打开 Actionscript 窗口并输入:

    导入 fl.controls.Button;
    导入 fl.video.FLVPlayback;

    var playBtn:Button = myButton;
    var flvVideo:FLVPlayback = myVideo;

    playBtn.addEventListener(MouseEvent.CLICK,buttonClick);

    函数按钮单击(e:MouseEvent) {
    var 按钮:按钮 = 按钮(e.target);
    按钮.启用=假;
    Button.label = "正在播放...";
    flvVideo.play();
    }

  8. 将 valerie.flv 文件上传到 html 和 swf 所在的同一文件夹。

  9. 发布 Flash 影片并将 html 和 2 个 swf 复制到该文件夹​​。

AS3 solution:

This all takes place on one frame in the timeline.

  1. Components Panel > Video > FLV Playback <-- drag this component on to the stage

  2. In Component Inspector panel, with flv playback instance selected, set:

    • source: valerie.flv (this is a relative html path that will only work if flv in same folder as your html and swfs)
    • autoplay: false
  3. Then, with flv playback instance selected, in Properties panel, set:

    • myVideo as the instance name
  4. Components Panel > User Interface > Button <-- drag on to stage

  5. With button instance selected, in Properties panel, set:

    • myButton as the instance name
  6. In Component Inspector panel, with button instance selected, set:

    • Label: Play Video
  7. With the frame selected that both these components are on, open Actionscript window and enter this:

    import fl.controls.Button;
    import fl.video.FLVPlayback;

    var playBtn:Button = myButton;
    var flvVideo:FLVPlayback = myVideo;

    playBtn.addEventListener(MouseEvent.CLICK, buttonClick);

    function buttonClick(e:MouseEvent) {
    var button:Button = Button(e.target);
    button.enabled = false;
    button.label = "Playing...";
    flvVideo.play();
    }

  8. Upload your valerie.flv file to the same folder where your html and swf will go.

  9. Publish the Flash movie and copy the html and 2 swfs to that folder.

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