Flash AS3 - Adding a loader instance to a specific frame

Associate
Joined
2 Sep 2007
Posts
1,975
I'm developing a basic cinema website and on a specific frame (Coming Soon) I'm adding a loader (YouTube video) using the quoted code below. This works fine although when someone navigates to a different frame the loader (YouTube video) is still appearing. I only want it to appear on that specific frame (Coming Soon). I think I know why it's happening. Is it because when the loader is added it's added to every frame? Any ideas on how to stop this happening?

I've uploaded the .fla to my Dropbox. To see the problem. Click on the Coming Soon button and then click on any other button - http://dl.dropbox.com/u/26733/CinemaWebsite.zip

The below code is on Frame 30 (Coming Soon).

PHP:
var my_loader1:Loader = new Loader();
my_loader1.load(new URLRequest("youtube/apiplayer?version=3")); 
my_loader1.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

var my_player1:Object;

function onLoaderInit(e:Event):void
{
	addChild(my_loader1);
	
	my_player1 = my_loader1.content;
	my_player1.addEventListener("onReady", onPlayerReady); 	
}

function onPlayerReady(e:Event):void{
	my_player1.setSize(200,160);
	my_player1.x = 70;
	my_player1.y = 420;
	my_player1.cueVideoById("diP-o_JxysA",0);
}
 
Back
Top Bottom