back to krasimirtsonev.com
to blog's home page

AS3: Using custom Metadata in Flex (part 1)

I'm sure that you've already used metadata tags in your flex applications. There are several reserved keywords like [Bindable], [Embed], [Event] and so on (the full list is available here). The function of the metadata tags is to provide additional information to the flex compiler. For example information about embeding assets, dispatching events. This article doesn't explain how to use the default flex tags (you can learn that from here). It shows you how to create your own metadata tags and how to use them.

First of all, to be able to use a custom tag you should inform the flex compiler about them. You can do that by adding a parameter to the additional compiler arguments like that:

Then you can write something like:

To use your tag's data you have to use flash.utils.describeType method. It returns a xml with information about your class. For example:
will return:

As you can see you have information about your metadata tag. You can use it to assign a value to your class's variable, to call a private method or something else.

Check part two » AS3: Using custom metadata in flex (part 2)
Sharing ...
Commenting ...
blog comments powered by Disqus