Hi Harbs, thanks for replying.
The specific case is an extension of the ComboBox control to which I want to 
add the default prompt.
Currently I have added it in addToParent but it doesn't work for me, although 
with debug, I see that it does add it and configure it correctly. See something 
wrong?

        private var textPromptBead:ComboBoxTextPrompt;

        public function ComboBoxWP() {
            super();
        }

        override public function addedToParent():void
        {
            super.addedToParent();
            var localtextPromptBead:ComboBoxTextPrompt = 
getBeadByType(ComboBoxTextPrompt) as ComboBoxTextPrompt;
            if (localtextPromptBead == null) {
                textPromptBead = new ComboBoxTextPrompt;
                textPromptBead.prompt = _textPrompt;
                addBead(textPromptBead);
            }
        }

        private var _textPrompt:String = "\u21F2 ...";
        [Bindable]
        public function get textPrompt():String{ return _textPrompt; }
        public function set textPrompt(value:String):void
        {
            _textPrompt = value;
            textPromptBead.prompt = _textPrompt;
        }

Thank you.
Hiedra

De: Harbs <harbs.li...@gmail.com>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: users@royale.apache.org
Asunto: Re: Add Beads

Good question. :-)

It depends on the type of bead.

Any beads that are added using MXML will be added in the addeToParent method. 
The reason for this is because many beads need the component to be added to the 
DOM.

If it’s a bead which does not need the DOM structure to be set up, you can 
simply add it in the class constructor after super().

HTH,
Harbs


On Jun 15, 2020, at 2:40 PM, Maria Jose Esteve 
<mjest...@iest.com<mailto:mjest...@iest.com>> wrote:

Hello,
I am extending a component and need to add a default bead to it. (This is a 
jewel control but I imagine it will be similar in basic or mx)
I have seen in the SDK code that there is no "fixed point" where to add it: in 
some controls they are added in the same constructor, in others they are added 
in the addToParent, in others in the addBead ...

Where should I do it?

Thank you.
Hiedra.

Reply via email to