//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;
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
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
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
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
] 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.setInterval;
import
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
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;
- Original Message
From: Glen Pike g...@engineeredarts.co.uk
To: Flash Coders List flashcoders@chattyfig.figleaf.com
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
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 also
10 matches
Mail list logo