How to specify a spark state name property declaratively on the value of a string variable

I have spark states declared in mxml. I also have a class with string constants. I want the names of my states to match string constants. Is it possible to do this directly in mxml and how? I don’t want to use the same string, I want to set the name property to a constant value.

the code:

public static const create:String = 'create';
public static const edit:String = 'edit';

MXML:

<s:State name="new"/>
<s:State name="edit"/>

As far as I know, state names should be processed at compile time, so this is probably not possible.

+5
source share
1 answer

Yes, the problem is that you cannot include constants in state declarations :(

+5

All Articles