tags:

views:

371

answers:

1

Is it possible, in flex, to assign multiple states as base for another state? Say I have state "stateA" that adds a button "buttonA" and state "stateB" that adds a button "buttonB". Is it possible to create a state "stateC" that is based on state "stateA" and "stateB"? If not, is there a workaround to accomplish that?

Also notice that the button IDs should be "buttonA" and "buttonB" and I can't have several buttons in different states with the same ID ...

Here is an example of what I want:

<mx:State name="stateA">
 <mx:AddChild>
  <mx:Button id="buttonA" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateB">
 <mx:AddChild>
  <mx:Button id="buttonB" />
 </mx:AddChild>
</mx:State>
<mx:State name="stateC" basedOn="stateA,stateB">
</mx:State>
+1  A: 

I don't think that is possible. But I seem to have a work around for this particular case:

  • stateC has both buttonA and buttonB
  • stateA, based on stateC, removes buttonB
  • stateB, based on stateC, removes buttonA

Would that suffice your use-case?

Amarghosh
Thinking outside the box ... very nice!
Ofir