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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping the movie while I play an animation...

Status
Not open for further replies.

albie101

Programmer
Oct 8, 2001
50
NZ
Ok, here's the deal...

I'm trying to create a quiz where the questions and answers are loaded from an XML file. Each question consists of "What letter does this start with?" and a picture (say an apple). I'm using loadMovie to load the pictures which are external swfs. That bit all works fine. The part I'm having trouble with is I want to play an animation when the user clicks an answer. I can get the animation to play (using another loadMovie), but it either plays so fast you don't see it, or it continues playing even after the next question appears. Basically I want some way of not loading the next question until the animation has finished or played for a certain amount of time.

Anyone have any suggestions? I don't have the fla up anywhere, but can email it if anyone wants to take a look...

Thanks!
Em

 
Condition the loading of next question on a variable set at the end of the animation.
mywink2.gif
ldnewbie
 
Thanks for the idea oldnewbie, but I would rather not put anything in the end of the animation as I am loading them through an XML (which holds the name of the swf to load) and want to have as much flexibility to change the questions in the quiz as possible. Having to put a variable in the end of each animation (which may be different for each question) cuts down this flexibility.

Is there some way I can keep everything in the background and just pause it while the animation plays for 10 seconds or so? I'm not to good on the layers/scenes etc. as I haven't been using flash for long.

Any other ideas anyone? Please give me a hand - I need to get this done ASAP for a guy at work.

Thanks
Emma
 
If you're using several different animations are they all the same length? If so you could trigger the loading of the next batch of XML data from a "master" clip when the animation reaches a particular frame using _currentFrame which saves you having to add variables to each different clip.

 
I'm not sure if the animations will be the same length or not. I guess they could be...

I'm sure there is an easy way to do this - maybe I'm just confusing things a little too much...

I'll have a look at using _currentFrame. Thanks.
 
no luck with _currentframe. It's doing some really wierd things :( I think it's because I'm using loadmovie which I read somewhere doesn't actually load the movie till all the rest of the code in the block is executed. Does anyone know anything about this?

Any other ideas?
 
Would this help?
Wait at current the advance after so many seconds: Code below:

_parent.stop();
startTime = getTimer();

function checkTime() {
currentTime = getTimer();
if (currentTime - startTime >= delay) {
if (playAfterDelay == "yes") {
_parent.gotoAndPlay(destination);
} else {
_parent.gotoAndStop(destination);
}
}
} A quick dirty way of pausing flash's timeline, you could however pause on a certian frame then use attch movie clip, or have it load your xml data on the fram thats paused then set the action to wait the amount that your xml data runs for, then play. Just a thought. Cheers,
MACROBRAIN
Macromedia Instructor
mailto:macrobrain@rjspowerbuilders.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top