5
votes

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

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 need to be processed at compile time so probably it's not possible.

1

1 Answers

5
votes

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