Search code examples
apache-flexcoding-stylestates

Changing Background Images per state


I have a Component that has a specific background image. The code looks like:

<mx:backgroundImage>@Embed(source='img1.png')</mx:backgroundImage>

<mx:states>
  <mx:State name='state2'>
    <mx:SetStyle name="backgroundImage">
      <mx:value>@Embed(source='img2.png')</mx:value>
    </mx:SetStyle>
  </mx:State>
</mx:states>

But when I change the state to 'state2', it doesn't actually change anything.

Am I missing anything specific here?


Solution

  • Because this seems to be kind of a weird error, my temporary solution is to have two canvases with different backgrounds that flip visibility depending on the state