In ActionScript, i've come accross a mindfart that i thought i'd put to the group....

Say I have three objects (don't lock into why, lets just say the heirachy tree make sense). Also note, these have nothing to do with the MX pre-built components, so please also don't associate them with this example.

Object1: UIObject
Object2: Label
Object3: InputField

The Top Down heirachy goes like this...

InputField extends Label
Label extends UIObject.


Now how would you expect the flow to work, keeping in mind you have to call the init method manually via the constructs...


I'm hoping to achieve:

UIObject Constructed...
UIObject Initialized...
Label Constructed...
Label Initialized...
InputField Constructed..
InputField Initialized...



Problem is: I get shit like

UIObject Constructed..
UIOBject Initialized
Label Initialized..
InputField Initialized..
Label Constructed..
UIOBject Initialized
Label Initialized..
InputField Initialized..
InputField Constructed..
UIOBject Initialized
Label Initialized..
InputField Initialized..

Anyone have some pointers when dealing with OOP heirachies as i always end up getting mindspooged over them.



----------------

ie the code would look like this:

class UIObject extends MovieClip {

        function UIObject() {
                trace("UIObject Constructed..");
                this.init();
                
        }
        function init() = function() {
                trace("UIObject Initialized..");
        }       

}

class Label extends UIObject {

        function Label () {
                trace("Label  Constructed..");
                this.init();
                
        }
        function init() = function() {
                super.init();
                trace("Label  Initialized..");
        }       

}


class InputField extends Label {


        function InputField () {
                trace("InputField Constructed..");
                this.init();
                
        }
        function init() = function() {
                super.init();
                trace("InputField Initialized..");
        }       

}










--


Regards,
Scott Barnes
-
http://www.mossyblog.com
http://www.bestrates.com.au

---
You are currently subscribed to fugli as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to