PDA

View Full Version : Loader and Progress Bar Synch Probs


mechan
07-07-2004, 01:24 PM
loader.autoLoad = false;
loader.content = "intro.swf";
pBar.source = loader;
loader.load();

Ok... i have this code a loader a progress bar and 2 probs:

My first prob is that the movie in the loader starts playing before the progress is completed resulting not to able to see what is palyed before it reaches 100% while the movie has already started playing ... in a few words no synchronization between the progress bar and the loader...

The second is that i if i put the progress bar behind the loader so that it will be covered by the loader content once loaded the progress bar won't show it's progress and will remain on 0% even though it's loading the content...
So what i need is a script that will allow me to have the prog bar in front of the loader and once the content is loaded the prog bar will disappear and not remain over the loaded movie.

I hope im not asking too much but it's kind of urgent and any help will be very appreciated.

you_rock
07-07-2004, 04:11 PM
Can you upload the fla.?

There are a number of things it could be.

mechan
07-08-2004, 10:45 AM
http://www.twilightzone2004.com/loader.zip

This is the fla that contains the loader and it's code... PLZ someone help me out... HEEEELLLLLLLLLPPPPPPPP!!!

you_rock
07-08-2004, 08:53 PM
I just started looking at it but noticed that your pBar component is mis-capitalized in the stage (pBar=code; pbar= stage).

Also trying putting the load in a function that uses the "complete" / on (complete) event.

I will look at this more tomorrow until then.

you_rock
07-09-2004, 07:38 PM
Ok, content is a reference property and contentPath is a property that returns a string. Basically contentPath is easier and better to use.

Then there was the capitalization error pbar / pBar.

Also I placed the different items on different levels to make it easier (this is a good practice).

Finally you need to read about the event and polled methods of the complete function for the p bar component. It will help you.

Finally I do not like to set component properties in the Comp Inspect. I use actionscript. If you press F1 when typing it brings up the help window and if you select a word it will tell you how to use it (and you don't have to search for it in the AS dictionary, since it jumps right to that entry in the Help window).

Good luck


loader.contentPath = "intro.swf";//is the path to the file
//loader.content =a reference to the content of the loader. The value is undefined until the load begins. contentPath returns a string.
pBar.setStyle("themeColor", "0x000044");
pBar.setStyle("color", "0x000044");
pBar.label = "%1 KB out of %2 KB loaded (%3%%)"
pBar.conversion = 1024;//1024 per byte
pBar.source = loader;
pBar.mode = "polled";//if you want it to disappear
pBar.complete=function(){//this way is better than placing the code inside the component using on(complete)
pBar._visible=false;
}
loader.load();