R – ‘[Inspectable]’ metadata tag

actionscript-3apache-flexflex3

Anyone can explain briefly about the [Inspectable] metadata tag. I read and could not understand in live docs.

Please help me when we are going to use the [Inspectable] metadata tag?

Thanks,
ravi

Best Answer

The tag is used with properties to provide code hints for that property and to specify the possible list of values that property can take while using it in mxml. Unlike [Bindable] metadata, this tag doesn't have much effect on the working of the code (other than specifying a default value) - this is used mainly to give directions to Flex Builder regarding how to deal with a particular property.

[Inspectable] metadata tag

Defines an attribute exposed to component users in the attribute hints and Tag inspector of Flex Builder. Also limits allowable values of the property.

For example, the verticalScrollPolicy property of the mx.core.Container class has the following [Inspectable] tag with it.

[Inspectable(category="General", enumeration="off,on,auto", defaultValue="auto")]
public function get verticalScrollPolicy():String
{
    return _verticalScrollPolicy;
}

This tells Flex Builder that this property should appear in the 'General' tab (it is 'Common' in my FB) of the Flex Builder's property inspector (open an mxml file, go to the Windows menu and select Flex Properties to open the property inspector - towards the upper side of inspector tab, near its title, you will find buttons to switch to standard view, category view, and alphabetical view). This property can take one of the three values off, on, auto and if none is specified it takes auto as its default value.

I've never used this tag and I believe you too won't be using it much unless you are writing a Flex API to be used by a bigger audience than your colleagues (or if you are a perfectionist).

Related Topic