1 Reply Latest reply on Jan 24, 2011 4:28 AM by Gurdeep Singh

    skinned ToggleButton

    alexandre.roitman Level 1

      Hello, I have two toggle buttons and I have two mxml files that are their skins.

      In each mxml skin there are 8 states ("up", "down",...)

      When I change state, I would like my toggle buttons to return to the up state, but if I call

       

      togglebutton1.currentState = "up";

      togglebutton2.currentState = "up";

      or

      togglebutton1.currentState = 'up';

      togglebutton2.currentState = 'up';

       

      I receive an error and the application breaks

      (ArgumentError: Undefined state 'up'.

      at mx.core::UIComponent/getState()[E:\dev\hero_private_beta\frameworks\projects\framework\sr c\mx\core\UIComponent.as:10457]

      at mx.core::UIComponent/findCommonBaseState()[E:\dev\hero_private_beta\frameworks\projects\f ramework\src\mx\core\UIComponent.as:10477]

      at mx.core::UIComponent/commitCurrentState()[E:\dev\hero_private_beta\frameworks\projects\fr amework\src\mx\core\UIComponent.as:10252]

      at mx.core::UIComponent/setCurrentState()[E:\dev\hero_private_beta\frameworks\projects\frame work\src\mx\core\UIComponent.as:10199]

      at mx.core::UIComponent/set currentState()[E:\dev\hero_private_beta\frameworks\projects\framework\src\mx\core\UICompo nent.as:6340]

      at Main/button_clickHandler()[...src\Main.mxml:111]

      at Main/__button1_click()[...src\Main.mxml:1638])

       

       

      I've also tried to call:

       

      togglebutton1.currentState = "";

      togglebutton2.currentState = "";

      and

      togglebutton1.currentState = null;

      togglebutton2.currentState = null;

       

      but it doesn't work, the buttons don't change their state.


      Can anyone help?

      Thanks a lot