I'm trying to make a preloader for an FLV within an SWF. In other words, I've placed the video in the time line. Because, like other Flash content, it takes a minute to load, I am tying to make a preloader for it. The preloader is supposed to be an animated gif over a dynamic text box which displays percentage loaded until the movie loads. Once loaded the time line should move to frame two which contains the FLV. It's not working out that way though. I've attached the SWF for clarity. Would someone mind helping me out, please? thanks

Member Avatar for rajarajan2017

This is the code you should write in the first frame of main timeline and second frame automatically play when your preloader complets.

stop();

addEventListener(Event.ENTER_FRAME, loading);
function loading(evt:Event) 
{
	var bytestotal = stage.loaderInfo.bytesTotal;
	var bytesloaded = stage.loaderInfo.bytesLoaded;
	var percentLoaded = Math.round(bytesloaded*100/bytestotal);
	preloader.gotoAndPlay(percentLoaded); // 100 frame pre-loader
	if (percentLoaded >= 100) 
	{
		removeEventListener(Event.ENTER_FRAME, loading);
		gotoAndPlay(2);
	}
}

I can't able to open your file from my office, becoz I have only flash 8. So if you are not able to succeed, tell me I will go thru your source from my home and give you the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.