I have a component with various states. From mxml, the includeIn and exclueFrom properties takes state groups as an argument. How can I check if the current state belongs to a state group?
views:
41answers:
1
+1
A:
State
has property stateGroups
that is Array of String
:
var n:int = states.length;
for (var i:int = 0; i < n; i++)
{
var state:State = states[i];
if (state.name == currentState)
{
trace("Current state (" + currentState + ") state groups: " + state.stateGroups);
break;
}
}
Maxim Kachurovskiy
2010-08-06 20:38:23
Thanks, that works. I didn't realize that states are more than strings. I'd expect the currentState to be of object 'State' or an easier way to get the currentState Object and groups array. So now I have a StatesUtil with some static methods.
swidnikk
2010-08-09 03:52:12