A little late in the (reply) game, but you could try:

MovieClip.prototype.onConstruct = function()
{
    trace("created")
}

This will be called anytime a new clip is created. You could, however, weed out 
the unwanted dispatching of events, by dispatching based upon the name of the 
clip created, i.e.:


 MovieClip.prototype.onConstruct = function()
 {
     if(this._name == "myMC"){
        trace("created")
    }
 }

Hope that helps.

---Original Message-----
From: flashcoders-bounces at chattyfig.figleaf.com
[mailto:flashcoders-bounces at chattyfig.figleaf.com] On Behalf Of Luca
Candela
Sent: donderdag 16 februari 2006 16:01
To: flashcoders at chattyfig.figleaf.com
Subject: [Flashcoders] dispatching events at creation time?

------------------
class tryOut {

    public var addEventListener:Function;
    public var removeEventListener:Function;
    private var dispatchEvent:Function;

    function tryOut() {
        mx.events.EventDispatcher.initialize(this);
        trace("I am Here 1");
        dispatchEvent({type:"created", target:this});

    }

    public function callMe():Void {
        dispatchEvent({type:"created", target:this});
    }
}
------------------
when I instantiate this class everything works except the dispatchEvent
in the constructor of the class. Why and how can I do to force an object
to call me back when he is created?

_______________________________________________
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