Jump to content


Wait function


  • You cannot reply to this topic
2 replies to this topic

#1 meadow

    Young Padawan

  • Members
  • Pip
  • 224 posts
  • Location:Devon, England
  • Interests:Php, Hockey, mysql, web design.

Posted 25 March 2006 - 10:46 AM

Is there any way to make action script wait for a number of milliseconds or seconds before moving onto another command, for example in this code:

onClipEvent (enterFrame) {

 this._x += 10;
 this._y += 10;
}
Would it be possible to add in a function like this:
onClipEvent (enterFrame) {

 this._x += 10;
 this._y += 10;
[i]wait(number of milliseconds);[/i]
}

Thanks for any help.

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 25 March 2006 - 11:33 AM

not really like that but similar, first you create a function that does what you are achieving:

myFunctionsName = function(){
  myCode
}

Then you create an Interval like this:
myIntervalID = setInterval(myFunctionsName,200);

If you just need the function call up once, then put this line at the end of the function but still inbetween the brackets

clearInterval(myIntervalID)

fyi.. time is being measured in miliseconds

#3 meadow

    Young Padawan

  • Members
  • Pip
  • 224 posts
  • Location:Devon, England
  • Interests:Php, Hockey, mysql, web design.

Posted 26 March 2006 - 09:05 AM

Thanks, that worked fine.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users