?
Solved

need help with preload animation in flash

Posted on 2007-04-04
12
Medium Priority
?
276 Views
Last Modified: 2010-04-03
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.
0
Comment
Question by:vee417
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
12 Comments
 
LVL 23

Expert Comment

by:Zeffer
ID: 18855857
your second one would work if you put it on frame 1 and changed the 'if'  statement to ..   >=    (greater than or equal to)... instead of..   <   .. (less than).

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


0
 
LVL 23

Expert Comment

by:Zeffer
ID: 18855862
first example ..on frame 2 should say..gotoAndPlay(1);

Z : )
0
 

Author Comment

by:vee417
ID: 18855897
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:ieciep
ID: 18855997
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
0
 

Author Comment

by:vee417
ID: 18856056
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?
0
 
LVL 3

Expert Comment

by:ieciep
ID: 18856092
hmmm ... try this

frame 1:
----------
if(_root.getBytesLoaded()<_root.getBytesTotal())
{
    gotoAndPlay(1);
}
else
{
    gotoAndPlay(3);
}

frame 2:
----------

gotoAndPlay(1);
0
 
LVL 3

Expert Comment

by:ieciep
ID: 18856110
or just simply write

frame 1:
----------
if(getBytesLoaded()<getBytesTotal())
{
    gotoAndPlay(1);
}
else
{
    gotoAndPlay(3);
}
0
 

Author Comment

by:vee417
ID: 18856190
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?
0
 
LVL 3

Expert Comment

by:ieciep
ID: 18856234
testing preloading:
----------------------

control > test movie

during testing...
goto View>Download Settings> 14.4
goto View>Simulate Download
0
 

Author Comment

by:vee417
ID: 18857841
yeah.. that's what i've been doing.  yet whatever code i put it just doesn't work.
0
 
LVL 23

Accepted Solution

by:
Zeffer earned 500 total points
ID: 18860117
thanks Riz.. yes stuffed that up..small error in yours as well..
----------
if(getBytesLoaded()<getBytesTotal())
{
    gotoAndPlay(1);  //  the player is not moving off frame 1

so vee try..
frame1..

if(this.getBytesLoaded()==this.getBytesTotal()){
    gotoAndPlay(3);
}

frame2
gotoAndPlay(1);

Z



0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question