In thinking about this a little more, I have come up with a third way of
achieving a private sub-component within an MXML-based component. Like the
others, this is somewhat hacky, but it should work. This one has the advantage
of allowing you to fully declare the sub-component using MXML. Further, using
this approach, your other MXML components can bind to the private
sub-component, although indirectly using what I'm calling a proxy.
Here's some sample code:
<mx:Script>
<![CDATA[
[Bindable]
private var textProxy:TextInput;
private function subDone(event:Event):void {
textProxy = event.target as TextInput;
}
]]>
</mx:Script>
<mx:TextInput creationComplete="subDone(event);" />
<mx:Text text="{textProxy.text}" />
Since the textProxy variable is private, and the TextInput control for which it
is a proxy has no id, I believe that this should create a situation equivalent
to where there was the ability to mark the TextInput control itself as private.
Hope that helps,
Sid
----- Original Message ----
From: Nate Beck <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, July 23, 2008 9:27:13 AM
Subject: [flexcoders] Re: Encapsulating a custom flex component?
A feature request has been opened for adding accessors to MXML. Please vote on
this if
you see fitting. It also better explains the issue that I am running into.
http://bugs. adobe.com/ jira/browse/ SDK-16181
There is also discussion going on about this issue at Jeff's blog:
http://www.jeffryho user.com/ index.cfm? mode=entry& entry=4DC9B79C- 65B3-D59C-
464EC981E0A2EA8F
Thanks,
Nate
--- In [EMAIL PROTECTED] ups.com, Jeffry Houser <[EMAIL PROTECTED]> wrote:
>
>
> In an ActionScript component, you can make the component internal to
> the package. You might also combine it with the "ExcludeClass" metadata
> tag to 'hide' the class name from people using your SWC.
>
> I'm not sure if I'd equate either of these approach to private, though.
>
> I blogged about this in a bit more detail:
>
> http://www.jeffryho user.com/ index.cfm? mode=entry& entry=4DC9B79C-
> 65B3-D59C-
464EC981E0A2EA8F
>
> Josh McDonald wrote:
> > Not in MXML components.
> >
> > -Josh
> >
> > On Wed, Jul 23, 2008 at 9:53 AM, Nate Beck <[EMAIL PROTECTED]
> > <mailto:nate@ ...>> wrote:
> >
> > Newbish question... but after searching on google, I can't get a
> > concise answer.
> >
> > Is it possible to encapsulate (mark private) components within a
> > Flex component?
> >
> > So I have custom MXML component (ResourcesTree) that has a Tree
> > inside of it. I don't want
> > the Tree to directly be available outside the ResourcesTree Component.
> >
> > Any input?
> >
> >
> > ------------ --------- --------- ------
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups. yahoo.com/ group/flexcoders /files/flexcoder
> > sFAQ.txt
> > Search Archives:
> > http://www.mail- archive.com/ flexcoders% 40yahoogroups. comYahoo!
> > Groups Links
> >
> >
> > mailto:flexcoders-fullfeat [EMAIL PROTECTED] .com
> > <mailto:flexcoders-fullfeat [EMAIL PROTECTED] .com>
> >
> >
> >
> >
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: [EMAIL PROTECTED] <mailto:josh@ ...>
> >
>
> --
> Jeffry Houser
> Flex, ColdFusion, AIR
> AIM: Reboog711 | Phone: 1-203-379-0773
> --
> Adobe Community Expert
<http://www.adobe. com/communities/ experts/members/ JeffryHouser. html>
> My Company: <http://www.dot- com-it.com>
> My Podcast: <http://www.theflexs how.com>
> My Blog: <http://www.jeffryho user.com>
>