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.

like so:

actionscript3 Bindable private var myString:String;

Inspectable (enumeration="stringValue1,stringValue2,stringValue3") public function set myString(val:String):void { myString = val; } /actionscript3

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.

<img src="http://feeds.feedburner.com/~r/KensoDev-en/~4/XjeBj6C1AUE" height="1" width="1"/>
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com