Action Script 3 (Flash) Timer - I cant set Timer properly

Posted by born2fr4g on Stack Overflow See other posts from Stack Overflow or by born2fr4g
Published on 2011-11-24T01:37:40Z Indexed on 2011/11/24 1:51 UTC
Read the original article Hit count: 175

Filed under:
|
|
|

I got function in Flash (Action Script 3) - that makes snowflakes falling. Now i want to make this snowflakes appear on screen only for 3 seconds. So I'm trying to use Timer class but i got problem:

var myTimer:Timer = new Timer(3000, 1); 
myTimer.addEventListener(TimerEvent.TIMER, snowflakes);
myTimer.start();

function snowflakes(event:TimerEvent):void {
 //snowflakes faling function
}

In this case snowflakes appear after 3 seconds and stay on the stage forver...So its kinda opposite what i wanted. I want them to appear from the very beginning then disappear after 3 second. How can I do that ?

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3