vee417
asked on
need help with preload animation in flash
i'm working on a flash movie and i'd like a preload animation (something that says "loading"). i put a movie clip of the animation i want in the first frame on a layer. the rest of the movie starts on frame 3. then i tried two things. first i tried putting this as an action on the first frame:
ifFrameLoaded(_totalframes ){
gotoAndPlay(3);
}
and this on the 2nd frame:
gotoAndPlay(1);
that didn't work so i tried putting this on the 2nd frame and nothing on the first:
if (_framesloaded < _totalframes) {
gotoAndPlay(1);
} else {
gotoAndStop(3);
}
i also put stop(); on the 3rd frame. i tried this method with "this." in front of everything as well.
for both, when i did control > text movie, the preload animation wouldn't play at all. and then when i pressed rewind, it would play indefinitely and the actual movie would never load.
what am i doing wrong?
thanks.
ifFrameLoaded(_totalframes
gotoAndPlay(3);
}
and this on the 2nd frame:
gotoAndPlay(1);
that didn't work so i tried putting this on the 2nd frame and nothing on the first:
if (_framesloaded < _totalframes) {
gotoAndPlay(1);
} else {
gotoAndStop(3);
}
i also put stop(); on the 3rd frame. i tried this method with "this." in front of everything as well.
for both, when i did control > text movie, the preload animation wouldn't play at all. and then when i pressed rewind, it would play indefinitely and the actual movie would never load.
what am i doing wrong?
thanks.
first example ..on frame 2 should say..gotoAndPlay(1);
Z : )
Z : )
ASKER
are you sure you've got the >= part right? if they're equal, shouldn't it gotoAndStop(3) and not gotoAndPlay(1) ? also, bytes_loaded didn't seem to be a variable but bytesLoaded is i think.
anyway, i tried it both the way you have it and with changing >= and bytesLoaded. neither worked.. i got the same problem as before in both cases. i really don't get it, it seems like this should work.
anyway, i tried it both the way you have it and with changing >= and bytesLoaded. neither worked.. i got the same problem as before in both cases. i really don't get it, it seems like this should work.
It should be
frame 1:
----------
if (_framesloaded >= _totalframes)
{
gotoAndPlay(3);
}
else
{
gotoAndPlay(1);
}
frame 2:
----------
gotoAndPlay(1);
i think Zeffer have mistakenly written gotoAndPlay(1) if _framesloaded are >= _totalframes.
Regards,
Riz
frame 1:
----------
if (_framesloaded >= _totalframes)
{
gotoAndPlay(3);
}
else
{
gotoAndPlay(1);
}
frame 2:
----------
gotoAndPlay(1);
i think Zeffer have mistakenly written gotoAndPlay(1) if _framesloaded are >= _totalframes.
Regards,
Riz
ASKER
still no luck :(
maybe it's the movie tester that's the problem? or maybe i need to put some actions in the movie clip that's on the first frame?
maybe it's the movie tester that's the problem? or maybe i need to put some actions in the movie clip that's on the first frame?
hmmm ... try this
frame 1:
----------
if(_root.getBytesLoaded()< _root.getB ytesTotal( ))
{
gotoAndPlay(1);
}
else
{
gotoAndPlay(3);
}
frame 2:
----------
gotoAndPlay(1);
frame 1:
----------
if(_root.getBytesLoaded()<
{
gotoAndPlay(1);
}
else
{
gotoAndPlay(3);
}
frame 2:
----------
gotoAndPlay(1);
or just simply write
frame 1:
----------
if(getBytesLoaded()<getByt esTotal())
{
gotoAndPlay(1);
}
else
{
gotoAndPlay(3);
}
frame 1:
----------
if(getBytesLoaded()<getByt
{
gotoAndPlay(1);
}
else
{
gotoAndPlay(3);
}
ASKER
still repeats the preload animation indefinitely when i click rewind :( . there must be something wrong besides the code on the first 2 frames.
when i open up the animation normally (not in control > test movie), it works fine but the preload animation doesn't show up at all. perhaps this is because it loads too quickly. so maybe the issue is with the movie tester. but then how should i test the preload animation?
when i open up the animation normally (not in control > test movie), it works fine but the preload animation doesn't show up at all. perhaps this is because it loads too quickly. so maybe the issue is with the movie tester. but then how should i test the preload animation?
testing preloading:
----------------------
control > test movie
during testing...
goto View>Download Settings> 14.4
goto View>Simulate Download
----------------------
control > test movie
during testing...
goto View>Download Settings> 14.4
goto View>Simulate Download
ASKER
yeah.. that's what i've been doing. yet whatever code i put it just doesn't work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
frame 1
if (_framesloaded >= _totalframes) {
gotoAndPlay(1);
} else {
gotoAndStop(3);
}
frame 2
gotoAndPlay(2);
just a note .. totalframes is now deprecated... in favour of bytesLoaded
so if you used the current format it would be..
frame 1
if (bytes_loaded >= bytes_total) {
gotoAndPlay(1);
} else {
gotoAndStop(3);
}
frame 2
gotoAndPlay(1);
Z