AFAIK, createChildren() may be called more then once during the app life cycle, so it's neccessary to check the existence of the children before creating it.
Jeremy.
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
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
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.
__,_._,___
Reply via email to