Replay button shows up before movie has loaded

Hi All…

I have a bit of a problem… I am loading an external Movie via FLVPlayback, after the movie has played - the REPLAY button shows up. Everything works except the REPLAY button shows up for a couple of seconds before the movie starts playing. I’m thinking that it’s because of my ‘If’ statement, which checks if the movie is PLAYING to show(or hide) the replay button… I’m super new to AS… can someone please help me out with how I can change the ‘if’ statement to look weather the movie is loading or playing…(if that’s the best way to go) I really appreciate any help and THANKS IN ADVANCE!!! Here’s the code:

import fl.video.*;
replay_btn.visible = false;

var myVideo:FLVPlayback = new FLVPlayback();
myVideo.source = “mgv_video.f4v”;
myVideo.skin = “SkinOverPlaySeekStop.swf”;
myVideo.skinAutoHide = true;
myVideo.skinBackgroundColor = 000;
myVideo.skinBackgroundAlpha = .5;
myVideo.width = 960;
myVideo.height = 540;

myVideo.addEventListener(VideoEvent.COMPLETE, completePlay);
replay_btn.addEventListener(MouseEvent.MOUSE_UP, replay);

function completePlay(e:VideoEvent):void {
removeChild(myVideo);
}

function replay(e:MouseEvent):void {
addChild(myVideo);
myVideo.play();
}

if(myVideo.playing) {
replay_btn.visible = false;
} else {
replay_btn.visible = true;
}

addChild(myVideo);

Hi - thanks for your help! this is the final code that worked well (the reason visible was removed from second posting is because i kept on working on it and switching things around ) :

import fl.video.*;
import flash.display.MovieClip;

var myVideo:FLVPlayback = new FLVPlayback();
var mybtn:myBtn = new myBtn();
var staticpic:staticPic = new staticPic();
var logo:Logo = new Logo();
var closebtn:closeBtn = new closeBtn()

myVideo.source = “BatterypoweredFCM.f4v”;
myVideo.skin = “SkinOverPlaySeekStop.swf”;
myVideo.skinAutoHide = true;
myVideo.skinBackgroundColor = 000;
myVideo.skinBackgroundAlpha = .5;
myVideo.width = 960;
myVideo.height = 540;

//DropShadow
function init() {
*** var dropShadow:DropShadowFilter = new DropShadowFilter();
*** dropShadow.distance = 4;
*** dropShadow.angle = 90;
*** dropShadow.color = 000;
*** dropShadow.alpha = .5
*** dropShadow.blurX = 10;
*** dropShadow.blurY = 8;


*** logo.filters = new Array(dropShadow);
}

mybtn.x = 515;
mybtn.y = 259;
mybtn.alpha = .8;

staticpic.x = 480;
staticpic.y = 270;
staticpic.alpha = .4;

closebtn.x = 915;
closebtn.y = 37;
addChild(closebtn);

logo.x = 37;
logo.y = 11;

myVideo.addEventListener(VideoEvent.COMPLETE, completePlay);
mybtn.addEventListener(MouseEvent.MOUSE_UP, replay);
closebtn.addEventListener(MouseEvent.MOUSE_DOWN, allvideos);

function allvideos(e:MouseEvent):void {
navigateToURL(new URLRequest(“Videos.aspx”));
}

function completePlay(e:VideoEvent):void {
*** addChild(mybtn);
*** addChildAt(staticpic,0);
*** removeChild(myVideo);
}

function replay(e:MouseEvent):void {
*** addChildAt(myVideo,0);
*** myVideo.play();
** removeChild(mybtn);
*** removeChild(staticpic)
}

addChildAt(myVideo,0);
addChildAt(logo,1);

init();

Did you set the visible property of replay to false before setting it to true ?

Hi Ferrari_chris - thanks you for your reply… I did that - however the result is still the same :frowning: here’s the code…

import fl.video.*;

var myVideo:FLVPlayback = new FLVPlayback();
myVideo.source = “mgv_video.f4v”;
myVideo.skin = “SkinOverPlaySeekStop.swf”;
myVideo.skinAutoHide = true;
myVideo.skinBackgroundColor = 000;
myVideo.skinBackgroundAlpha = .5;
myVideo.width = 960;
myVideo.height = 540;

myVideo.addEventListener(VideoEvent.COMPLETE, completePlay);
replay_btn.addEventListener(MouseEvent.MOUSE_UP, replay);

function completePlay(e:VideoEvent):void {
replay_btn.visible = true;
removeChild(myVideo);
}

function replay(e:MouseEvent):void {
addChild(myVideo);
myVideo.play();
replay_btn.visible = false;
}

addChild(myVideo);

Show the replay button on the COMPLETE event:

function completePlay(e:VideoEvent):void {
replay_btn.visible = true;
removeChild(myVideo);
}

Then you can completely remove your if statement from further down the code.

:slight_smile:

Haha, good catch.

It was at the top of the code in the first post, but mysteriously missing from the second post.

:crazy: