Monday, December 8th, 2008

Gotcha: Adding Metadata to a Flex Component

By Javier Julio

Recently, I noticed that as I was adding event metadata to my custom Flex components, Flex Builder wasn’t giving me code hints for those configured events. For example, I would do the following:

[Event(name='complete', type='flash.events.Event')]

Since I wasn’t seeing the event in the code hints list I looked at some inner Flex framework components like Button or TextInput to see what I was doing wrong. Everything matched but then I realized the only difference was that they used double quotes. Aha! Once I switched the above metadata example to the following, everything worked out:

[Event(name="complete", type="flash.events.Event")]

The complete event showed up in the code hints list when trying to add an event listener for my custom component. This isn’t a complaint on Flex Builder, as I normally use double quotes–so I blame this on laziness and copying and pasting the metadata line but to others be careful and note to see the event (or any other metadata type e.g. styles) show up in the code hints list always use double quotes!

2 Responses

  1. Namrata said:

    oh………… gr8…………sometimes this coma and semicolon irritates you a lot

  2. Namrata said:

    oh…………… preety cool idea…………………

Leave a Comment