When you want to basically handle constructs, you typically want to over-ride contructObject2 method.
Inside this method, a object is passed in (initObj), which basically contains all the childDescriptors/properties associated with the tag in question. Example
class com.myclass extends mx.containers.Canvas {
public function constructObject2( initObj:Object ) : Void
{
// Insert your construct space here...
super.constructObject2(initObj);
// Or Here...
}
}
Now, essentially its this point where you need to ascertain what you want to do. An example for me, was that i wanted one tag to divert its "children" into a sub-container, i create via AS instead of MXML. So essentially what i've done is intercept the initObj, splice out my chosen children (you will need to inspect initObj to get an understanding of it *see below*) and put them inside a private array, rebuild the initObj array and let the code carry on.
Then down in say, createChildren() i then carry out further logic.. (ie createChild(mx.containers.HBox,"myname", myInitObj)
What i do is this:
myInitObj = new Object();
myInitObj.childDescriptors = mySplicedOutArray;
createChild(mx.containers.HBox,"myName", myInitObj);
Now, since Trace in FLEX 1.5 is non-existant or at best cumbersome (praise FLEX 2.0)... i utilise FAST (See Macromedia.com) and to inspect the object, i'd have something like this:
class com.myclass extends mx.containers.Canvas {
public function constructObject2( initObj:Object ) : Void
{
// Insert your construct space here...
_level0.debug = initObj;
super.constructObject2(initObj);
// Or Here...
}
}
Then load up fast/echo/console/EchoConsole.mxml, and inspect _level0.debug
On 10/25/05, Libby <[EMAIL PROTECTED]> wrote:
I am trying to extend the Canvas in an .as file, following the Rich
Client book by Webster et al, of course mine is more complicated as it
contains other components whose attributes need to be initialized. I
need to pass some attributes in via the constructor. Could someone
show me a code snippet that illustrates this, or tell me the "right"
way to do it?
Thanks,
Libby
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
Regards,
Scott Barnes
http://www.mossyblog.com
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

