How to get reference of a MovieClip on stage from a class?

I 'm trying to get access to a MovieClip (which is on stage) from a class.
I 'm using this code:
In the class constructor:

public function MyClass() {

if (stage) init();
                else addEventListener(Event.ADDED_TO_STAGE, init); 
}

And function init:

        private function init(e:Event = null):void 
        {
            trace("init");
            removeEventListener(Event.ADDED_TO_STAGE, init);
                        
            trace("init");
            //trace(My_mc=stage.arrow_mc);
            //trace(My_mc.name);
           
        }

But the function init() doesn’t even get executed!
(the code in the constructor is executed. I also get no error)

Is this the correct way to refer to a MovieClip on stage from within a class?
Why on earth init function doesn’t execute?

(taken from here)

Where do you make an instance of MyClass? Is it the document class? Or a linked symbol on your timeline?

The two excerpts you posted look correct to me, so the problem must be elsewhere.

The “correct” way, is to pass a reference of your movie clip to the instance of your class when its created.

If you’re creating a manager-style class where it needs to keep track of more than just a single instance, or track the state of a timeline, then you can pass a reference to the timeline itself, or the stage if it is to manage the stage.

A little less versatile is having the instance find its own reference. If you know where your target movie clip is, e.g. stage.arrow_mc, then if your class extends some kind of DisplayObject like MovieClip and you add your instance of that class to the display list, then your ADDED_TO_STAGE event will fire and you’ll have access to the stage which will allow you to find it. The case where stage is available in the constructor (rather than having to wait for the event) is when you drag an instance of that class from the library onto the stage in the authoring tool.

Using a non-DisplayObject/MovieClip class instance gets no stage object and no ADDED_TO_STAGE event, so init will never fire (if this was the case for you, you’d probably get an error when trying to access stage). Using a DisplayObject/MovieClip class instance but not adding it to the display list means in the constructor stage will be null and the ADDED_TO_STAGE event never fires (since its never added) so init is never called then either. So adding to the display list is critical to making this work

I finally dit it by passing the movieclip as a parameter to a function of the class instance (not the constructor).
I suppose that’s what you mean too.

function or constructor works. A function would be needed if you’re adding the instance to the stage from authoring and not creating it with new. Making it required in the constructor, for example, could let you have better assurances as to its existence helping protect from possible null references in code, but that’s not really a big deal. Either way