that is not what is happening here.
try this:
class TestClass1 {
   public function TestClass1() {
       trace("TestClass1 TestClass1 TestClass1 ");
   }
}
class TestClass2 extends TestClass1 {
   private static var instance:TestClass2 = null;
   public static function get smething():TestClass2 {
       if(instance == null) {
           instance = new TestClass2();
       }
       return instance;
   }
}

and in movie:
var aa = TestClass2.smething;

Constructor trace is executed well

2006/10/23, Hans Wichman <[EMAIL PROTECTED]>:

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
>
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> 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
>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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