When I define custom propertie in my MXML component, I also want to define a set of possible values of that property to make Flex Builder show then (possible values of the custom property) when I invoke code completion function.
Any idea how it could be done?
Use the [Inspectable] metatag with enumeration
attribute.
The
[Inspectable]
metadata tag defines information about an attribute of your component that you expose in code hints and in the Property inspector area of Flex Builder.
[Inspectable(defaultValue="abc", enumeration="abc,xyz,pqr")]
public var myProp:Boolean;
Your Mxml part of the custom compoenent , as mine is :
<com:CustomWindow width="100" height="130" frontImageSrc="{rp.currentItem.path}"
showText="{rp.currentItem.imgtext}" hideImage="{rp.currentItem.noImage}"
buttonMode="true" useHandCursor="true" mouseChildren="true"/>
Actionscript part is : -
//Inspectable metadata tag gives you the option in the flex builder
//to choose an option from the available selected options
//Put it with the getter of that particular property
[Inspectable(defaultValue="true", enumeration="true,false")]
public function get showImage():Boolean
{
return _imgVisible;
}
public function set showImage(str:Boolean):void
{
_imgVisible = str;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With