1 Reply Latest reply on Jul 25, 2010 3:00 PM by Shongrunden

    Problem with states

    gunterVS

      Hi,

       

      I'm working on an game using Robotlegs. I have a DataGroup which I have given a property "type", which defines if it is used to show objects from the cpu or the human player.

       

      Depending on this type I set my state in the mediator of the mxml item renderer which is as follows:

      if(view.parent is HandView)
      {
           if((view.parent as HandView).type.value == PlayerType.CPU.value)
           {
           view.setCurrentState(view.FACE_DOWN);
           }else if((view.parent as HandView).type.value == PlayerType.HUMAN.value){
           view.setCurrentState(view.FACE_UP);
           }
      }
      

      view is the item rendered and HandView is the DataGroup componen. PlayerType is an enumeration class for the type of player.

       

      At first this seems to work, but as soon as I go over the item renderer with my mouse cursor it changes state again.

      Any idea how this can happen? There are no event listeners on the component and this piece of code is the only code I have manipulating it's state.