Reputation: 13
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.
Upvotes: 0
Views: 1256
Reputation: 10743
AS3 solution:
This all takes place on one frame in the timeline.
Components Panel > Video > FLV Playback <-- drag this component on to the stage
In Component Inspector panel, with flv playback instance selected, set:
Then, with flv playback instance selected, in Properties panel, set:
Components Panel > User Interface > Button <-- drag on to stage
With button instance selected, in Properties panel, set:
In Component Inspector panel, with button instance selected, set:
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(); }
Upload your valerie.flv file to the same folder where your html and swf will go.
Publish the Flash movie and copy the html and 2 swfs to that folder.
Upvotes: 1