Struggling with passing paramaters to inherited class

Hi, I have been struggling with this for the last day or so and have been searching around but cannot seem to find anything relevant.

I am trying to send paramaters to the inherited class (mc) from the child ‘mcEvent’ but can’t work out how. i have tried the C++ method but that just gives me an error about return type

Here is my child class ‘mcEvent’ (I should point out, the name may be misleading in that it actually handles no events but it is for “events at different venues” within my app)


package classes {
    
    public class mcEvent extends mc {
        
        private var clip:Object = null;                    // Target clip
        private var funcOnClick:Function = null;        // Function to execute on click 
        public function mcEvent(funcOnClick_p:Function=null, clip_p:Object = null) /*: mc(clip_p, null, null, funcOnClick_p)*/ {
            if (funcOnClick_p==null) {
                throw new Error("mcEvent class constructor has invalid paramaters");
                return;
            }
        }
    }
}

and for reference, the ‘mc’ class (this one handles the events :P)


package classes {
    
    import flash.display.Stage;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    public class mc {
        
        private var clip:Object = null;                    // Target clip
        private var funcOnAdd:Function = null;            // Function to execute on add to stage 
        private var funcOnEnterFrame:Function = null;    // Function to execute on enter frame 
        private var funcOnClick:Function = null;        // Function to execute on click 
        
        public function mc(clip_p:Object=null, funcOnAdd_p:Function=null, funcOnEnterFrame_p:Function=null, funcOnClick_p:Function=null) {
            if (clip_p==null || funcOnAdd_p==null || funcOnEnterFrame_p==null || funcOnClick_p==null) {
                throw new Error("mc class constructor has invalid paramaters");
                return;
            }
            clip = clip_p;
            funcOnAdd = funcOnAdd_p;
            funcOnEnterFrame = funcOnEnterFrame_p
            funcOnClick  = funcOnClick_p
            
            clip.addEventListener(Event.ADDED_TO_STAGE, clipAdd);
            clip.addEventListener(Event.ENTER_FRAME, clipEnterFrame);
            clip.addEventListener(MouseEvent.CLICK, clipClick);
        }
        
        private function clipAdd(event:Event) {
            //trace("added: " + clip.name);
            clip.removeEventListener(Event.ENTER_FRAME, clipAdd);
            funcOnAdd();
        }
        private function clipEnterFrame(event:Event) {
            //trace("entered frame of: " + clip.name);
            funcOnEnterFrame();
        }
        private function clipClick(event:Event) {
            //trace("clicked: " + clip.name);
            funcOnClick();
        }
    }
}

If anyone can point me in the right direction it would be much appreciated.
Thanks in advance,
Spatty

P.S.
I only started using AS 3.0 about a week ago and so far have been learning as i go, Does my code look ok? is it sloppy? am i doing things the long/hard way? any feedback and tips are much appreciated also :slight_smile:

P.P.S
sorry, i should really have posted this in the A.S 3.0 forum :confused: i didnt notice it somehow.