Initially while loading something into a movieclip bytesLoaded and bytesTotal may equal. The value may be either the current bytesize of the movieclip or -1. So first do an unload on the target movieclip and then make sure that the amount of loaded bytes is larger than the movieclips initial size. For an empty movieclip put on stage at authortime that size is 4 bytes.
if i understand, we must create another temp MC ( “temp” ) to make the “onEnterFrame” and make the preloader ? but why ?
another question about your AS code: what’s the " [COLOR=#0000FF]if[/COLOR] COLOR=#000000" condition ? i don’t understand…
so, this is my version, it’s seems to work… ( but i think i will try your AS code i know you legendary AS code quality )
[/COLOR]
if you can explain me my AS error, you’re welcome !
thanks !
[COLOR=#0000FF][/COLOR][COLOR=#000000][/COLOR]onEnterFrame = function () {
var loaded:Number = bgConteneur.getBytesLoaded();
var total:Number = bgConteneur.getBytesTotal();
var percent:Number = Math.round((loaded/total)*100);
preloader_mc.percent = percent+"%";
if (percent>=90) {
bgConteneur._alpha += 2;
preloader_mc.tween(["_y", "_alpha"], [0, 0], 4, "easeOutExpo");
if (bgConteneur._alpha>=100) {
delete this.onEnterFrame;
play();
}
}
};
bgConteneur.loadMovie("backgrounds/backg_1.jpg");
If you load something into a movieclip all properties of that movieclip are reset to default. For example the onEnterFrame handler the movieclip had before it loaded has to be replaced by a new onEnterFrame handler the loaded movie uses. That’s why I use mc ‘temp’.
if (bgConteneur._width) {
checks if bgConteneur has a width (ie is full loaded), as long as it is not loaded, it will returns false (width=0).
In your code, it’s better to assign the onenterframe to a mc plus (as said above) you can’t use the alpha property before it’s fully loaded, so the