PDA

View Full Version : Preloader doesn't work on Flash 8


cperes
09-26-2006, 05:36 PM
Hi all,

I've been looking for a preloader that works in flash 8 in all kind of forums for the past 2 hours and I can't seem to find it.
I have this code in a preloader movieclip with another mc called loadBar and a dynamic text with a variable called percentage inside. And this is the code I have on it:

onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}


I took it from another thread and it works fine when exported as flash player 6 and 7 but when I try it with Flash 8 it doesn't... it stays stopped in 0%. I don't know why, and I can't seem to figure it out. I only want to preload the general movie in which I charge the others and I'm getting desperate.
Thanks for the future help! :)

PS. I'm attaching the movie that I found in the other thread (in flash 4 and 5 forum I think). Please try to publish it in flash player 8 to see what I mean

kennard
09-26-2006, 11:58 PM
I think Flash 8 has a problem with you trying to affect a variable with itself before its declared, ie. percent -= (percent-((loading/total)*100))*.25"percent -= itself" before its declared will become undefined and never start working again. Try declaring percent = 100 or something, before your onEnterFrame starts executing. :o

oldnewbie
09-27-2006, 04:28 AM
Code removed.

Then your onClipEvent(enterFrame)...

Still a bad preloading code IMHO... After the initial preloading (when the file is cached...) on a re-load or Refresh, the preloader will always re-appear and is but a faked display then, since the file is already cached.

cperes
09-27-2006, 01:19 PM
Hi! Thank you for your replies, it works now!

But Oldnewbie is right, it's not a good preloader because ir preloads every time I enter the site, even when the page is already loaded.

Do you know any preload that works well in flash 8?

I have a very big movie that really needs a preloader...

The problem is that every time I put a:

if(loading==total){
this._visible=false;
//_parent.gotoAndStop(2);
}else{
this._visible=true;
}

it simply doesn't work again... it stays in white until it completly charges...

oldnewbie
09-27-2006, 02:31 PM
;)