You're mixing an instance of the Timer class with setInterval. In order
for a timer to run, you have to tell it to start. Secondly, since the
method the Timer calls is _addNewFlame - that method needs to have an
event specified as an argument.
private function _addNewFlame(event:TimerEvent):void
{
}
I would use either the Timer or setInterval, but I wouldn't try and mix
them both.
Jason Merrill
Instructional Technology Architect
Bank of America Global Learning
Join the Bank of America Flash Platform Community and visit our
Instructional Technology Design Blog
(Note: these resources are only available for Bank of America
associates)
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of John
Singleton
Sent: Friday, June 18, 2010 11:52 AM
To: Flash Coders List
Subject: Re: [Flashcoders] 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 flash.utils.clearInterval;
import flash.utils.Timer;
import flash.events.TimerEvent;
import fireBall;
public class Fire extends MovieClip
{
private var mcFlameContainer:MovieClip;
private var uintMakeAFlame:uint;
private var i:Number = new Number(0);
private var kids:Number = new Number();
private var t:Timer = new Timer(15, 10);
public function Fire()
{
mcFlameContainer = new MovieClip();
addChild(mcFlameContainer);
t.addEventListener(TimerEvent.TIMER, _addNewFlame);
// for (i=0; i < 10; i++)
// {
// uintMakeAFlame = setInterval(_addNewFlame, 15);
// }
}
private function _addNewFlame():void
{
var flameNew:fireBall = new fireBall();
mcFlameContainer.addChild(flameNew);
flameNew.y = 200;
flameNew.x = 200;
kids = mcFlameContainer.numChildren;
flameNew.x = 20 + (kids * 10);
trace('hi');
}
}
}
TIA,
John
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders