I have an instance of a movieclip Video_Flow called flow. I'm trying to make it to play only when you press a button, but for some reason the audio starts playing every time I run the program. This is my code:
var flow:Video_Flow = new Video_Flow();
PlayButton.addEventListener(MouseEvent.CLICK, PlayVideo);
function PlayVideo(event:MouseEvent)
{
addChild(flow);
flow.x = 0;
flow.y = 50;
}
Because in AS3 objects can exist and operate even if they are not added to display list. As soon as you instantiate your Video_Flow it starts playing video. Adding it to display list only makes you able to see it.
var flow:Video_Flow;
PlayButton.addEventListener(MouseEvent.CLICK, playVideo);
function playVideo(e:MouseEvent):void
{
flow = new Video_Flow;
flow.x = 0;
flow.y = 50;
addChild(flow);
}