Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event Metadata: Using static variable for "name" attribute?

I want to use the Event metadata tags to show what types of event my control will dispatch. The syntax looks like:

<fx:Metadata>
    [Event(name="eventName", type="MyEvent")]
</fx:Metadata>

It seems like a best practice in Flex/Actionscript to define static variables that define event names like so:

public class MyEvent extends Event
{
    public static const EVENT_NAME:String = "eventName";
    // Other stuff..
}

It's a great practice since the event name can change easily and not have to be modified throughout the code. So my question is: Is there any way to use this static const in my metadata event tag? I can't seem to do something like this:

<fx:Metadata>
    [Event(name="{MyEvent.EVENT_NAME}", type="MyEvent")]
</fx:Metadata>

Am I just ignorant of the proper syntax to do this, or is it impossible? Seems like it's just asking for hard to find bugs if someone decides to change the const since it is not strongly typed here. Thanks in advance!

like image 589
Ocelot20 Avatar asked Jun 24 '11 20:06

Ocelot20


1 Answers

The bad news is it is impossible :( I dream about this possibility but…

like image 113
Constantiner Avatar answered Oct 27 '22 01:10

Constantiner