no need for the counter in the event handler, Timer has a "repeat count"
//Timer(delay, repeatCount)
var timer:Timer = new Timer(5000, 1000);

----- Original Message ----- From: "Nathan Mynarcik" <nat...@mynarcik.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, February 04, 2010 10:37 PM
Subject: Re: [Flashcoders] making a repeating effect


You can try this:

timer.addEventListener("timer",timedFunction);

var counter:int;

timer.start();

function timedFuntion(e:TimerEvent):void{
 if(counter <= 1000){
var heart:MovieClip = new Heart();
heart.x = Math.random * stage.stageWidth;
heart.y = Math.random * stage.stageHeight;
counter++;
}else{
timer.stop();
}
}
------Original Message------
From: Gustavo Duenas
Sender: flashcoders-boun...@chattyfig.figleaf.com
To: Flash Coders List
ReplyTo: Flash Coders List
Subject: Re: [Flashcoders] making a repeating effect
Sent: Feb 4, 2010 3:14 PM

I've downloaded thanks
on other matters, when you say using a timer, you mean something like this ( I've have this from a tutorial, mixing with my idea);

something like this?

import flash.utils.*;

var timer:Timer = new Timer(5000);

timer.addEventListener("timer",TimedFunction);


timer.start();

function timedFuntion(e:TimerEvent):void{
 var heart:MovieClip = new Heart();
heart.x = Math.random * stage.stageWidth;
heart.y = Math.random * stage.stageHeight;

}

the question is , how can I stop this?

Gus
On Feb 4, 2010, at 3:40 PM, Jer Brand wrote:

Completely un-helpful for your code, but you could also give HYPE a
whirl. Have been having a blast playing with it lately. I think the
above task is one of the examples.


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to