RE: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Merrill, Jason
>> Merrill thought I was mixing the timer with setInterval, but all of that code was commented out. Singleton, I didn't notice it was commented out since in my reader the // was mixed in with >>, but either way, you really should just post the relevant code if you want people to look it over. I a

Re: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread John Singleton
- Original Message > From: Glen Pike > To: Flash Coders List > Sent: Fri, June 18, 2010 11:25:24 AM > Subject: Re: [Flashcoders] Function Doesn't Increment Properly > > t.start() ? Oh :-} Yeah, that worked. Merrill thought I was mixing the timer with setIn

Re: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Glen Pike
t.start() ? On 18/06/2010 16:52, John Singleton wrote: First, a word of thanks to Glen Pike. That was slick, numChildren! Second, I like Michael Mendelsohn's idea, however, for what event am I listening? package { import flash.display.MovieClip; import flash.utils.setInterval;

RE: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Mendelsohn, Michael
Hi John... You're listening for TimerEvent.TIMER. when you instance a new Timer, you pass two parameters. First, you pass the time in milliseconds, from your code, it was 15. Then instead of looping through to get 10 instances of the fireball, just run the timer 10 times. That's the second

RE: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Merrill, Jason
lashcoders] Function Doesn't Increment Properly First, a word of thanks to Glen Pike. That was slick, numChildren! Second, I like Michael Mendelsohn's idea, however, for what event am I listening? package { import flash.display.MovieClip; import flash.utils.set

Re: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread John Singleton
First, a word of thanks to Glen Pike. That was slick, numChildren! Second, I like Michael Mendelsohn's idea, however, for what event am I listening? package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import flash.utils.Ti

Re: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Henrik Andersson
The timeout runs after the loop completes. The callback will use the current value of i, and the loop leaves it at 10. So naturally, that is what the timeout will see. I fail to see the purpose of setting a timeout in a loop like this. Just move the loop to inside the timeout. This way, you ca

Re: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Glen Pike
Hi, Maybe it's because you looped through the loop before you started adding flames - e.g. i is 10 by the time the first flame is added... Can you just use the number of children already in the container to set the x position of the next flameNew? Glen __

RE: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Mendelsohn, Michael
Assuming you're using AS3, you might want to rewrite it as such: public function Fire() { mcFlameContainer = new MovieClip(); addChild(mcFlameContainer); var t:Timer = new Timer(15, 10); t.addEventListener(TimerEvent.TIMER, _addNewFlame, 15); } Forget the

RE: [Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread Cor
//Try this : package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import fireBall; public class Fire extends MovieClip { private var mcFlameContainer:MovieClip; private var uintMakeAFlame:uint;

[Flashcoders] Function Doesn't Increment Properly

2010-06-18 Thread John Singleton
Hi; The following script fully increments the value of i every time it calls _addNewFlame. I would have thought (and need) that the value of i would be incremented with each call. Please advise. TIA, John package { import flash.display.MovieClip; import flash.utils.setInterval; impo