[flashpro] i need help with a preloader
Timo Stamm
t.stamm at macnews.de
Wed Oct 26 19:11:19 EDT 2005
Hi Victor,
I guess you have the preloader in the same movie that you are loading.
This can cause problems if you use embedded assets, because flash
exports them to the first frame. This means that a lot of data is loaded
before your preloader is displayed.
I think you can tell flash in what frame to export the assets. But a
much more reliable way is to use a seperate movie as a preloader.
Example:
Assuming your main movie is called main.swf, create a new flash document
with the same dimensions and framerate as main.fla.
Place a dynamic textfield on the first frame, with the name "progress_tf".
Use the following script on the first frame:
this.createEmptyMovieClip("main_mc", this.getNextHighestDepth());
this.main_mc.loadMovie("main.swf");
this.onEnterFrame = function () {
var l = this.main_mc.getBytesLoaded();
var t = this.main_mc.getBytesTotal();
var percentageLoaded = Math.round(l / t * 100);
this.progress_tf.text = "" + percentageLoaded + "% loaded";
if (t > 100 && l == t) {
// loading complete
this.progress_tf._visible = false;
this.onEnterFrame = undefined;
}
}
Of course you can use a bar or anything else as a display for load
progress. I chose a textfield for simplicity.
The script isn't tested, but it should work. If you have any problems,
just ask, I am sure someone will help.
Timo
Victor Dumitrescu wrote:
> i created a preloader and i have a little problem with it. (in mx 8)
> it's not showing from the start but only after it loads around 100k of
> the swf movie.
> can you please give me a hint or something
> i saw yesterday on the internet an article regarding this problem and
> i didn't save it and now i am sorry.
> please help me
> thanks
> ------------------------------------------------------------------
> send message to the list: mailto:flashpro at muinar.org
> [FlashPro] list info, subscribe, archive: http://flash-list.com/
> There's also a WebPro mailing list: http://webdesign-list.com/
> cutting-edge sounds for flash: http://flash-sounds.com/
>
More information about the FlashPro
mailing list