|
|
|
[
Permlink
| « Hide
]
Tink - [07/23/08 11:06 AM ]
An accessor tag would be a great addition to MXML. Please gives us the ability to use the accessors provided to us in AS 3.0.
I have not tried it out, but this blog post seems to provide a solution by using a metadata tag: http://blog.ashier.com/2008/03/25/hiding-properties-in-flex-components/. Perhaps all that is needed is better documentation.
I checked out that article with high hopes that it would work... it doesn't. Unless I'm doing something wrong:
[ExcludeTesting.mxml] <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" xmlns:local="*" creationComplete="init();"> <mx:Script> <![CDATA[ import mx.controls.Button; private function init():void { var mybtn:Button = myComp.btn; mybtn.label = "Wootage"; } ]]> </mx:Script> <local:MyComponent id="myComp" /> </mx:Application> [MyComponent.mxml] <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" height="300"> <mx:Metadata> [Exclude(name="btn", kind="property")] </mx:Metadata> <mx:Button x="167.5" y="146" label="Click Me" id="btn" /> </mx:Canvas> It still allows me to access the sub-component, change properties on the sub-component etc. So unfortunately this doesn't solve the issue. I'm in the same boat. I read the blog post, thought it sounded great, and posted about it here. Then I tested it (which I guess the original author didn't do), found it didn't work, and came back to post a correction. Sorry about the misinformation. BTW I've also commented at the site I quoted so hopefully others won't repeat my mistake.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||