Hi,
what is the output?
greetz
JC

On 10/23/06, Andreas R <[EMAIL PROTECTED]> wrote:

//parent class:

class no.rayon.aronning.StateMachine.prototypes.BaseState implements
no.rayon.aronning.StateMachine.interfaces.IState
{
   public var stateName:String;
   public var addListener:Function;
   public var removeListener:Function;
   private var broadcastMessage:Function;
   public function enter(m:BaseGameEntity){
   }
   public function execute(m:BaseGameEntity){
   }
   public function exit(m:BaseGameEntity){
   }
   private function BaseState(stateName:String)
   {
       AsBroadcaster.initialize(this);
       this.stateName = stateName;
       trace("new state: "+stateName);
   }
}

//child class (condensed)

class states.GoHomeAndSleepTilRested extends BaseState implements IState
{
   private static var _instance:BaseState;
   function enter(m:Character){
       if(m.location!="home"){
           trace("Tired, going home to sleep");
           m.changeLocation("home");
       }
   }
   function execute(m:Character){
       trace("Zzz..");
   }
   function exit(m:Character){
       trace("Yawn... Sleep time is over");
   }
   private function GoHomeAndSleepTilRested(){
       super("Go home and sleep til rested");
   }
   public static function get():BaseState{
       if(!_instance){
           _instance = new GoHomeAndSleepTilRested();
       }
       trace(_instance.stateName);
       return _instance;
   }
}

Basic singleton for the child. When get() is called on the child,
superconstructor is *not* called.
Not even when called explicitly with super().
Class members of superclass can still be accessed, but no constructor. Say
what?

Am i missing something obvious?

- A

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to