well i'm not sure what you're actually trying to do but you can hide
the id within a certain scope.


look at code:
MyApp.mxml
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
layout="absolute">
        <myCanvas id="mycanvas" />
</mx:Application>


myCanvas.mxml
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
width="400" height="300">
        <testcmp id="mypanel">
                <myButtons>
                        <mx:Button id="btn1" label="button 1" />
                        <mx:Button id="btn2" label="button 2" />
                </myButtons>
        </testcmp>
</mx:Canvas>

testcmp.mxml
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"; width="400"
height="300">
        <mx:Script>
                <![CDATA[
                        import mx.controls.Button;
                        public function set myButtons(value:Array):void
                        {
                                _myButtons = value;
                                _myButtonsChanged = true;
                                invalidateProperties();
                        }
                        
                        public function get myButtons():Array
                        {
                                return _myButtons;
                        }
                        
                        protected var _myButtons:Array
                        protected var _myButtonsChanged:Boolean;
                        
                        override protected function commitProperties():void
                        {
                                if (_myButtonsChanged)
                                {
                                        _myButtonsChanged = false;
                                        removeAllChildren();
                                        var l:int = _myButtons.length;
                                        for (var i:int = 0; i < l; i++)
                                        {
                                                var btn:Button = _myButtons[i];
                                                addChild(btn);
                                        }
                                }
                        }
                ]]>
        </mx:Script>
</mx:Panel>




So you can access the button ID's via the panel.
Only the canvas.


--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> Bummer... I've got some classes in which I'm doing a lot of the stuff
> declaritvely in MXML, and I just didn't want the ids leaking into
the public
> API.
> 
> I guess I'll just have to rethink things a little bit, make the
declarative
> stuff the public API, and have it reference the functions that are
declared
> in <mx:script> that used to be ;-)
> 
> -J
> 
> On Thu, May 8, 2008 at 11:30 AM, Bjorn Schultheiss <
> [EMAIL PROTECTED]> wrote:
> 
> >   Everything you described is possible except the protected instead of
> > public part.
> > At some point one of the accessor must be public.
> >
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
"Josh
> > McDonald" <dznuts@> wrote:
> > >
> > > Hey guys,
> > >
> > > Is it possible to define (non visual) components in MXML that are
> > protected
> > > instead of public, but can still be referenced by the ID (or a
name, or
> > > something)?
> > >
> > > Cheers,
> > >
> > > -J
> > >
> > > --
> > > "Therefore, send not to know For whom the bell tolls. It tolls for
> > thee."
> > >
> > > :: Josh 'G-Funk' McDonald
> > > :: 0437 221 380 :: josh@
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for
thee."
> 
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>


Reply via email to