flex2_createandextendcomponents.pdf is careful to repeate that if you are 
extending a component, in your createChildren() method, test for existence 
of children before creating them to allow subclasses to "create a different 
child instead"(e.g., page 168).

However, the children in that (and every other) example come from private 
variables in the component with no getters/setters, so the subclass would 
not be able to access them to create a "different child instead"... am I 
missing something important?

Example:

public class ModalText extends UIComponent {

...

private var text_mc:TextArea;

private var mode_mc:Button;

...

/*** Implement the createChildren() method. ***/

// Test for the existence of the children before creating them.

// This is optional, but do this so a subclass can create a

// different child instead.

override protected function createChildren():void {

super.createChildren();

// Create and initialize the TextArea control.

if (!text_mc) {

text_mc = new TextArea();

...

addChild(text_mc);

}

// Create and initialize the Button control.

if (!mode_mc) {

mode_mc = new Button();

....

}



--
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/
 


Reply via email to