Groups | Blog | Home
all groups > flash actionscript > august 2005 >

flash actionscript : Who can explain this?


Ghooostwheel
8/29/2005 11:41:20 PM
Okay, here's the code:

if (loaded > 0 && _root._framesloaded == _root._totalframes) {
_root.gotoAndPlay(Done);
}

And here's the trace when the movie continues to play, with only 3 frames
loaded (3rd frame is a loop-back to frame 2):

Frames loaded 3
Total Frames 301

.... and then it just continues to play from there. Is this a band-width test
error, or is this something I've overlooked (yet) again?

Any help appreciated...
Jeckyl
8/30/2005 12:00:00 AM
[quoted text, click to view]

what is the variable 'loaded' .. is it greater than zero?

[quoted text, click to view]

is 'Done' a frame label .. in which case it should be in quotes .. "Done".
If it is a variable, then what value is it?

Jeckyl

Jon Moyles
8/30/2005 12:00:00 AM
can you verify that its this if statement that is evaluating to true?
put a trace in it ie:

if (loaded > 0 && _root._framesloaded == _root._totalframes) {
_root.gotoAndPlay("Done");
trace("why on earth would this be true?");
}

this will tell you if its this or your gotoAndPlay(2) that isnt working

luck
jon

NSurveyor
8/30/2005 12:00:00 AM
Ghooostwheel
8/30/2005 12:18:01 AM
I've tried this method with both _framesLoaded and _getBytesLoaded, with every
friggin thing I can think of... It just hits the 3rd frame ( code:
gotoAndPlay("2"); ) and it just sluffs off the rest of the load and proceeds to
fade out the preload and on to the movie.

Yes, "Done" is a frame label (my mistake, posted wrong code), and still
proceeds from frame 3 when only tiny bit of movie is loaded...

From the latest test:

Bytes loaded 48151
Total Bytes To Load 1763482

That's from the Output window... am I crazy, or does

if (_parent.getBytesLoaded() == _parent.getBytesTotal()) {

not work? (you can sub _root.getBytes... etc. I've tried em both, as well as
assigning variables, etc.)
abeall
8/30/2005 12:24:42 AM
Why not use an onEnterFrame event?

_root.onEnterFrame = function(){
if (_root.getBytesLoaded() == _root._getBytesTotal()) {
_root.gotoAndPlay('Done');
delete _root.onEnterFrame;
}
Ghooostwheel
8/30/2005 12:40:36 AM
I get what you're alluding to, abeall, but I'm not sufficiently actionable (if
that's a term) to re-work the code you're suggesting. I'm just looking for the
screw-up I've created, not re-writing the code. I understand from reading what
you're suggesting, but I'm afraid that would immerse me in even more of a
morass than I'm already in. I'm not a script-junkie, I just know how to code,
and take hints from peeps. (the code came, actually from Mr. Moock's excellent
book, originally, but had to be altered to fit a different scenario.) I
understand the syntax, but the execution of your suggestion would be... well...
probably the end of my sanity. I'm having enough trouble as it is. lol But
thanks.
Ghooostwheel
8/30/2005 10:36:10 AM
Yes to both, Jon. I've tried that as a trace... in many different ways. Lose
one condition, lose another condition, lose all conditions, change them... I've
tried every iteration that I can think of.

And yes, Ghostwheel a la Zelazny. Good eye! (Unfortunately, I can't code like
he did, Dad.)
Ghooostwheel
8/30/2005 10:56:16 AM
Hello, NSurveyor,

FIle is available at
http://ca.geocities.com/sean_murphy@rogers.com/Content_Final2.fla

Hope you can help!

(The code is as I last left it... probably messy with traces and crap... hope
you'll pardon that... lol)
Jon Moyles
8/31/2005 12:00:00 AM
on frame 3 you need to corect your goto:

gotoAndPlay(2);

i think somebody mentioned this one.

thats all you need to get your preloader going till it loads. your if
statement doesnt fire when you do load all content so you probably need
Jon Moyles
8/31/2005 12:00:00 AM
ok, i was wrong about somebody mentioning the gotoAndPlay thing, in fact
the advise i'm refering to may have caused you to put quotes on this
(frame numbers = no quotes, frame labels = quotes)

the other thing seems to be caused by your first frames code setting a
lot of properties that dont exist yet. move your objects back a frame or
your code foward to where the objects exist. moving foward will cause
you to need to adjust your gotoAndPlay(2)

williamy NO[at]SPAM qq.com
8/31/2005 12:00:00 AM
you wanna build a loading bar?
well use onenterframe is the right way
code here:
//---------------------------------------------
onEnterFrame=function(){
if("needed have been loaded"){
gotoandplay(XXX);
delete onEnterFrame
}
}
//---------------------------------------------
So when the swf is running on this frame,this code will happenmany time until
the condition "needed have been loaded" is true

williamy
Ghooostwheel
9/1/2005 10:33:24 PM
Hi Jon,

There were several problems with the code (including those you mentioned, yes)
but you started it on the right path.

Thanks again. If I could ever return the favour (eek), gimme a shout.

-GW
Jon Moyles
9/5/2005 12:00:00 AM
AddThis Social Bookmark Button