开发者

Actionscript Button click to Flv video Help

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜