Preloader question. agh!

I’m not sure why I am so incompatible with preloaders. After so much struggling I got my first one to work, but now I can’t get preloaders to work again with the site I’m currently working with. It just either goes straight to the main screen, or ignores the preloader and just loads while having a blank screen.

I also have a question, is a preloader like this

if (_framesloaded>=_totalframes) {
gotoAndPlay (2);
} else {
gotoAndPlay (1);
}

only for animations, and not web navigation purposes? I tried using this for my <A HREF=“http://sonmi.150m.com/flash/”>site</A> that I’m working on, but it did not do anything.

Could my problem be that I’m putting the loader in a separate scene? It seems it should work okay then, though, because on frame two I have it gotoAndPlay the next appropriate scene.

Bah. I don’t know why this isn’t working now. Even kirupa’s show bytes/total bytes preloader isn’t working. :sleep:

Well…first of all you shouldnt use scenes. Scenes are outdated and Macromedia themselves recommend you not to use them. Remnants from older versions where they actually were useful. Today: use layers. Anyway, your script is checking if ALL frames are loaded. If yes, then continue, if no, repeat the procedure. Thus it only involves your flash movie, not whatever site it links to.

But try Kirupa’s thingy again:

if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
_root.gotoAndPlay (2);
}

are you talking about not using scenes with the preloader, or just using scenes at all? if you mean the latter, then i’m confused. i use scenes to animate between different contents, which often requires more than just a loadmovie action.

i’ll try using that script again.

sorry if I’m being pushy, but I’d like to put the loader on soon because it’s the last thing I need to finish.

Plus the scenes thing has me confused.

Does no one use scenes anymore? I’m not sure why my other preloader would have worked. It was this one:

onClipEvent (enterFrame) {
var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if (bytes_loaded == bytes) {
_root.gotoAndPlay(2);
this.kirupatxt = “movie loaded”;
} else {
_root.gotoAndStop(1);
this.kirupatxt = “loading (” + bytes_loaded + “/” + bytes +")";

}

}

Could it have been because I used Flash 5? I’m using Flash MX now, and am baffled as to why the preloader isn’t working.

bah! nevermind. i guess it was just a matter of not being able to view the preloader in flash mx. when i actually uploaded it to my server it worked. is there any way to see how the preloader looks in flash mx? i thought that the ctrl+enter thing twice would work the same as flash 5, but i guess not!

yes there is…and I have a further suggestion

The way to view your preloader is this.

With the movie in test mode (CTRL+Enter) click on the menu item “view/bandwidth profiler”. The movie will then have a section at the top that shows how much k each frame has in it. From here, you can use the menu item “debug” to select a bandwidth that you like. For viewing preloaders your best bet is to pick something small like 56k.
With both of those set you can select menu item “view/show streaming” and it will reload the movie as if it were viewing it on that type of connection.

I usually reserve the first 2 frames in the movie (NO SCENES!) for my Preloader…

Frame 1:
(ActionScript)
var percent = Math.Ceil((_root.getBytesLoaded() / _root.getBytesTotal()) * 100 );
progressbar.gotoAndStop(percent);

Frame 2:
(ActionScript)
if (percent < 100 ) {
_root.gotoAndPlay(1);
}else{
_root.gotoAndPlay(3);
}

Of course, I have a Movie Clip called “progressbar” that is just a 100 frame progress bar that tweens from frame 1 to 100.

That’s how I make all my preloaders.
Hope that helped a bit… Write me at "srogers@thirdcoastmedia.com" if you need more help.

:cyclops: