0
votes

I've Just started learning actionscript 3.0, and I got a problem. I just want a symbol to be in the stage for many times ,not in a same time, but it brings them all in at the beginning. I just used this piece of code below:

for (i=1,i<10,i++){
  stuff();
}
function stuff():void {
  theSymbol.x=(Math.random()*100);
  addChild("theSymbol");
}

Is there any other ways to :

  1. Bring the symbol into the stage many times "not in a same time" ,in a while.

  2. Call a function many times without using "for".

Thanks for any Ideas .PLZ answer soon as possible! ;)

1

1 Answers

0
votes

I believe you wanna do something like:

setInterval(stuff, 1000) // call stuff() once every second.
function stuff():void {
   theSymbol.x=(Math.random()*100);
   addChild("theSymbol");
}

Does it helps you?