Merrill, Jason wrote: > > When using your own custom made components in MXML, what is the best way > to easily set properties? I.e., say I have a simple component that has > an image inside a panel, and I want to set the image source in my MXML, > like this: > > <c:MyImageComponent imageSource="myPhoto.jpg" /> > > The way I figured was to setup the component like this with a public > property - this works, but seems kinda kludgy - isn't there a more > preferred way (WITHOUT doing it all in Actionscript)?
No, that's pretty much how you do it. If you need more granual control over the properties you can create get and set methods. I'm sure you can find info in the docs on such things. > Bonus question - is there a way to make the component ids inside of the > main component private? (i.e., in the example above, make the id for > the <mx:Image> component private). Because when I see code hinting, I > see both the public property imageSource, but also the Image component's > id, "userPhotoImage", which I would prefer to keep private. For this I believe you have to create the sub component in ActionScript. However, once you add it to the stage people can still get to your subcomponent using the 'children' methods; unless you override them to ignore your children of course. -- Jeffry Houser, Technical Entrepreneur, Software Developer, Author, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Company: <http://www.dot-com-it.com> My Podcast: <http://www.theflexshow.com> My Blog: <http://www.jeffryhouser.com>

