Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disfasia - Regarding your i-home.fla... 1

Status
Not open for further replies.

oldnewbie

Technical User
Dec 6, 2000
9,142
CA
First off, your preloader is peculiar!
Do you allways want to go through this on each subsequent visit to your site?
You shouldn't use the ifFrameLoaded action, it's deprecated in Flash 5. Use _framesloaded & _totalframes.

That said, the ifFrameLoaded action, still works and that is not the source of your problem.
When addressing the main timeline from within a movie clip or a loaded movie, you must use a cumulative number of frames or a labeled frame to target a particular frame, because movie clips (and loaded external .swfs) see the main movie as one big scene even if it holds several of them.
Since your preloader lasts 91 frames, and you're targeting frame 2 of scene 1, you have to add all previous frames in your goto (91 + 2 = 93):

on (press) { // I hate the release state!
_root.gotoAndStop(93);
...
}
You must use the preceding _root, otherwise you'd be targeting the menu movie clip itself.

Because you might decide to change the lenght of your preloader (thus having to re-calculate the total number of frames in all of your targets!), a better way to target frame 2 of your main movie, is simply to label that frame with a unique label. Thus select frame 2, and in the frame panel name it frame2 or whatever and then use that label in your buttons:

on (press) { // I hate the release state!
_root.gotoAndStop("frame2");
...
}

Regards,
wink4.gif
ldnewbie
 
Thanks you so so much for this help! My gosh, I was going bald over this issue...

As for the preloader, I must confess that I don't know the other way of preloading... Why has the ifFrame loaded depreciated in Flash 5 by the way?

Regards,
 
Flash 5 actionScript has a couple of ways of building preloaders rather than ifFrameLoaded, the most accurate is to check how many bytes have been loaded rather than how many frames (because some frames may be empty and others may have huge graphics to be loaded which makes things uneven).

Here's a script for you...

frame 1
Put a text box on the stage set to variable "percent". This will display how much of your movie has loaded.

Frame 2
loaded=_root.getBytesLoaded();
total=_root.getBytesTotal();
percent=Math.round(loaded/total*100);
if(percent<100){
gotoAndPlay(1);
}


You could also use this to display how many KB have loaded by adding this line and a textBox with variable set to &quot;amount&quot;.

amount=(total-loaded)/1024;

I think Old's comments about deprecated syntax are valuable - you might put something together today that won't work under Flash 6 in a few months time (unlikely but still a possibility).




 
Wang, if I may add my two cents worth...

I personally favor using a seperate scene for preloaders, and usually make them 3 frames long.
To avoid seeing a flash frame of the preloader on subsequent visits to the site, the first frame is allways a blank keyframe with something like:

if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
gotoAndPlay (&quot;Scene 1&quot;, 1);
}
// You can use the above... Or the following...
// if (_framesloaded == _totalframes) {
// gotoAndPlay (&quot;Scene 1&quot;, 1);
// }

This way, if the movie is already in the user's cache, it jumps directly to the movie, without displaying anything.

Second frame:
Basicly the same as the first... This is where the preloader goes into works, on a first visit.

if (_root.getBytesLoaded()>=_root.getBytesTotal()) {
gotoAndPlay (&quot;Scene 1&quot;, 1);
}
// You can use the above... Or the following...
// if (_framesloaded == _totalframes) {
// gotoAndPlay (&quot;Scene 1&quot;, 1);
// }

// + any textfield displays and/or movie clips
// on other layers, for sake of clarity...

loadedBytes = _root.getBytesLoaded();
totalBytes = _root.getBytesTotal();

// Etc...

Third frame:

// The loop...
gotoAndPlay (2);

Regards,
wink4.gif
ldnewbie
 
Even better. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top