lexshine
asked on
Flash CS3 Timer routine
I am working in Actionscript 3.0
I have two functions
startSomthing();
endSomething();
I also have an array
"one","two","three"
I need a routine that will move through the array and execute the following functions
startSomthing(); for a set amount of time, say 1 minute
endSomething(); execute the end routine after 1 minute
then repeat until all elements of the array have been passed through, so based on the array above it would last for 3 times.
I have tried some things in Actionscript but havent been able to figure out the routine to make this happen.
thanks
I have two functions
startSomthing();
endSomething();
I also have an array
"one","two","three"
I need a routine that will move through the array and execute the following functions
startSomthing(); for a set amount of time, say 1 minute
endSomething(); execute the end routine after 1 minute
then repeat until all elements of the array have been passed through, so based on the array above it would last for 3 times.
I have tried some things in Actionscript but havent been able to figure out the routine to make this happen.
thanks
ASKER
Well, Here is what I have going on now. I call showPlay() which calls the function CircleFocus which starts the action.
I then have a timer that shuts down the CircleFocus routine called CircleRemove.
That is the equivilent of startSomthing and endSmthing running.
What I need to know is how to move through the array and call showPlay(), then recognize when its done and go to the second element in the array and call showPlay() again, etc.
I then have a timer that shuts down the CircleFocus routine called CircleRemove.
That is the equivilent of startSomthing and endSmthing running.
What I need to know is how to move through the array and call showPlay(), then recognize when its done and go to the second element in the array and call showPlay() again, etc.
public function showPlay(){
var wholeTimer:Timer = new Timer(1000, 15);
wholeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onWholeComplete);
wholeTimer.start();
function onWholeComplete(event:TimerEvent):void{
CircleRemove();
}
CircleFocus();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As I understand you want to call startSomething and then have another function that after 1 minute will stop the execution of startSomething. This is just not possible because Flash is single-threaded so as long as startSomething is running you cannot call another function. Also you can't just stop a function from executing.