[thelist] setInterval in class method

Jan Guichelaar [artmiks] jan at artmiks.nl
Wed May 25 04:14:28 CDT 2005


Hi All

I have a problem with the setInterval function, wich i call from inside 
a class.
I have 2 classes, one extends the other. When i call a method from the 
extended class directly it workd fine, but when i call that same method 
from within the setInterval it doesn't seem to reach the method.

These are my 2 classes:

class Part {
    /*
    * Constructor
    */
    public function Part () {
        trace("part created");
    }
    /*
    * register a node from this part to organism
    */
    public function registerNode():Void {
        trace("registerNode");
    }
}

class Branch extends Part {
    private var growTimer:Number;
    /*
    * Constructor
    */
    public function Branch () {
        trace("branch created");
        startGrow();
    }
    /*
    * start growing this part
    */
    private function startGrow():Void {
        trace("start grow branch");
        grow(); // this reaches the registerNode method fine
        growTimer = setInterval(grow, 500); // this doesnt work
    }
    /*
    * grow this part
    */
    private function grow():Void {
        registerNode();
        trace("growing branch");       
    }
}


Inside the Constructor from the Branch class, the startGrow method is 
called.
When i call the grow method directly, this reaches the registerNode 
method in the extended Part class.
When i call the grow method with setInterval, it doesnt.

Why?
thanx for any help on this

Jan



jan at artmiks.nl
 
Artmiks [image builders]
http://www.artmiks.nl  [now even in CHINESE]
====================
recent projects
http://www.kesselskramer.com  [update 2004 projects]
http://www.liptonicetea.nl  [create your own summer]
http://www.bronregisteraccountants.com  [the source]
====================





More information about the thelist mailing list