Actionscrip v2 animation sequence problem!

Hello All,

This is the problem I am facing. I am doing a 3d site in which I have to manipulate a lot of the animation via actionscript, a sneak peak can be found http://existanze.com/luminous/ (Version 4). I am moving into the next step wich is to animate the different objects on the site.

I need to be able to work in sequences, in simple terms, when one animation finishes another begins. This sounds simple, but its not if you are animating using loops and so on. If I was using tweening I could easility add a keyframe that would trigger the next part of the animation.

An example would be more appropiate. If I have three functions, turnLightsOff(), fallDown(), grow().

turnLightsOff() gradually decreases the alpha
fallDown() gradually decreses the _y position by 10
grow() gradually scales an mc.

When I put one method after the other, they start in the correct order, but they all get carried out at the same time. How can I restrict fallDown() from being carried out until turnLighsOff() has finished execution?? And add delays between each animation.

Please remember that each method is executed between different mc’s not on the same one.

Thank in advance for any replies.

Hello again,

Please any experts out there, I really need the help. I have tried everything, from using setInterval to delay the animation the necesary amout, to creating an event based animation using AsBroadcaster and listeners, but I am still getting the same problem. Please if there is anythin ambigous about my question ask me(constructively) and I will answer.

Thanks in advance,
Gyftus

you’ll probably want to create callbacks for your methods so that when they finish they can call a function which will initate the next step

Ive made something similar which can be found at proto.layer51.com which is called… I think “function array” or something (there might be 2 or 3 with a simiar concept, just look through the methods under my user name and you can probably find what Im talking about). Anyway, what Im thikning of lets you define function calls in an array where only the current function call is run until that function returns true (or is it false?) Once that happens, the array proceeds to the next entry and the next defined function is run.

Something revolving around a similar concept can be done with just a simple incrementing number value and a switch/case block. have the number start at like 1 and case 1: will run your first function. When thats dont, increase the number by 1. case 2: then runs the next function and so on.

hello again,

Thanks for your reply senocular, but there is a little problem with what you are suggesting, it is very usefull but now there is a second problem. I am using the mx.transitions.Tween class that has been discovered and documented by some people. This class has an event handler onMotionFinished, that suposedly tells you when the animation is finished. Now if I have 30 mc’s that have this function as a prototype, I don’t have a way of knowing when the last transition finished!!! What is happening is that the animation starts and midway the next animation starts. Do you or anyone in the forums know what I am missing, or can point me in the right directionl.