Simple code problem!

Hi, i have a simple problem, that should work!

Here is the site - monoequip

on the home page is a news scroller which has a preloader!

The preloader is on one scene (loader) and the content is in another (content)

on the first frame (loader)I have this code:

[AS]
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded (“loader”, 30) {
gotoAndPlay (“content”, 1);
}
[/AS]

So if the user has veiwed this before then the flash should skip the preloader part and go straight to the (content) scene! but it does not, it just plays through the (loader) scene and then plays.

If you to the site above, you see the percentage loader appear and then the content should appear once loaded, this works fine. try going to any link and then go back to the homepage and you will see what i mean!

Can someone help out!

Thanks in advance

well you can make your IFFramesLoaded on frame 1, if not loaded go to frame 2 where your preloader script will be

edit: btw do you mind me asking why your naviagtion is in flash? honestly dude, i’ve found out that if you dont need flash then you shouldn’t use it, ya know? you should think about making your nav using css.

nice site :slight_smile:

hey man sry, i didn’t notice you replied to this thread.

i can’t post the fla, you won’t be able to open it in flash 5.

i have 2 scenes.

in scene 1 frame 1


bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBarFill._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
	this.gotoAndPlay(3);
}

in scene 1 frame 2


gotoAndPlay(1);

this works fine for me, it should for you as well.

hey man sry, i didn’t notice you replied to this thread.

i can’t post the fla, you won’t be able to open it in flash 5.

i have 2 scenes.

in scene 1 frame 1


bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBarFill._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
	this.gotoAndPlay(3);
}

in scene 1 frame 2


gotoAndPlay(1);

this works fine for me, it should for you as well.

Thanks Digitalosophy, but I don’t think I explained myself very well. I have a preloader that works fine, like the one you have kindely posted! The preloader AS is on frame 5 & 6.

What I need on frame one is another piece of code which checks to see if this movie has been loaded before, if it has then go straight to the next scene and skip frame 5 & 6 altogether.

Something like this I was thinking:

[AS]
if (_framesloaded > 0 && _framesloaded == _totalframes) {
gotoAndPlay (“contents”, 30);
} else {
gotoAndPlay (“loader”, 4);
}
[/AS]

Hope you get me, like I said if you check the url in the first post and refresh the home page, you’ll see that the preloader appears for a few seconds, even though the movie has already loaded! just want to skip this.

Thanks

Kev