PDA

View Full Version : Percentage PreLoader Blues


SuperKurt
01-16-2003, 06:31 PM
I've tried to adapt a Percentage type Preloader to reveal the word loading as it goes. I've used a mask and put it in a seperate scene. I have three scenes, Pre-Loader, Girl and Manikin.

Here is the code I've used:

total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
percent_done = int((loaded_bytes/total_bytes)*100);
mask.gotoAndStop(percent_done);
ifFrameLoaded ("Manikin", 30) {
gotoAndPlay("Girl", 1);
}

When I publish, it just plays the first frame of the movie and then goes to the next scene.

You can find the original .fla file that I'm working on at http://www.downtownmedia.com/graf/grafv2.fla .

Any help would be appreciated. Even if you can just spot the bug.

Thanks in advance.

- Kurt

GWiNet
01-16-2003, 07:45 PM
1st of all, the fla you link to is empty - no scenes, no content, nada.

2nd, when you test it, are you testing it on the web server, or on your local machine? if you test it locally, it'll load too fast for the preloader to do anything, so it would just play.

SuperKurt
01-16-2003, 08:15 PM
Not sure why you couldn't get the .fla file. I downloaded the link to my desktop and it was 150k. If you were perhaps looking for the .swf file instead, it can be found at http://www.downtownmedia.com/graf/graf_v2.swf

As for testing, I've tested it both locally with a 14.4 modem selected in the preview and also with my own browser online.

http://www.downtownmedia.com/graf/index.html will allow you to see the page I've been testing.

simontheak
01-17-2003, 07:57 AM
I had a look at the links you posted up (nice site by the way!) and it seems as though you've got some kind of masking effect going on already. I'm guessing it's not what you want though, so I thought I'd throw my two cents in!

I've been trying to do the same thing as you ... but I've done it slightly differently. Instead of getting Flash to gotoAndStop in a particular frame of your mask, I decided to use the _xscale property.

So my code looked like this:

Frame 1:


total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();

if(loaded<total){
percent = int((loaded_bytes/total_bytes)*100);
_root.mask._xscale=percent;
}
else{
gotoAndPlay("Start");
}


Frame 2:
gotoAndPlay(1);

I'm not sure if that's any use to you, but I just thought I'd mention another way of doing it, that might be more succesful for you