ActionScript2 - How to delay the execution (controlling the speed of animation via coding)

hi experts,


i need to make an animation in 10 steps in a for () loop:

for (i=0; i<10; i++)
{
step i; //whatsoever.....
delay(xx);
wait(xx);
}

is there any function to insert it in the loop to control the speed of execution? kinda of delay(xx);   or wait(xx); ?

Many thanks in advance.
regards,
Raul
raulmondaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Antonio EstradaTech Leader / Senior Web DeveloperCommented:
The only similar things are setInterval() or setTimeout() but those can't be used inside a for loop, it should be something like this:

var i:Number = 0;
var max:Number = 10;
var seconds:Number = 1;
var interval:Number;

startUp();

function startUp():Void
{
	 interval = setInterval(countFunc, seconds * 1000);
}

function countFunc():Void
{
	i++;
	trace(i);
	if(i == max)
	{
		clearInterval(interval);
	}
}

Open in new window


Good luck!
-V
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
raulmondaAuthor Commented:
Thank you. Ill look on it to implement it on my project.

Regards,
Raul
0
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
Glad to help!

-V
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.