Enumeration on a property – Flex 3
lack of documentation often lead to situation when the developer consuming your component doesn’t know what are the values you expect of him to set.
Well, there’s a solution for this, Flex introduced the “Inspectable” metadata tag, you can simply set this tag above your setter and the developer will get full intellisense and be able to know what you meant.
In this simple application, I create a custom mxml component based on Canvas, I create a property called myString and created an “Inspectable” metatag.
private var _myString:String;
public function set myString(val:String):void
_myString = val;
So far, it’s as simple as it can get, now, check out a screenshot of my flex builder when setting this property from outside
And that’s it, that’s how simple it is to create enumeration and ease the life on your fellow developers.Submit to Hacker News
[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.
[NOTE] updated April 7, 2010. It's 3218 days old . This article may have outdated content.