0 Replies Latest reply on Apr 12, 2012 3:42 PM by karenehartley

    Error on actionscript state change using RemoveChild

    karenehartley Level 1

      I have an actionscript component (a View) with a number of states defined in the following manner:


      var stateDefault:State = new State();

      stateDefault.name = "DefaultState";

      stateDefault.overrides = new Array();// array of IOverride


      stateDefault.overrides.push(new RemoveChild(btn_MatterPicker_Search));


      When attempting to run the line

           currentState = "DefaultState";

      the error below occurs.  I'm hoping that someone has a simple solution to this - the only thing I can think of at the moment is to write my own state change handler that adds and removes the appropriate items from each state manually.  Does anyone have a more elegant solution?  (The code needs to remain as actionscript, can't switch to mxml.)


      Here's the error:

      Error: removeChild() is not available in this class. Instead, use removeElement() or modify the skin, if you have one.

          at spark.components::Group/removeChild()[E:\dev\4.y\frameworks\projects\spark\src\spark\comp onents\Group.as:2136]

          at mx.states::RemoveChild/apply()[E:\dev\4.y\frameworks\projects\framework\src\mx\states\Rem oveChild.as:150]

          at mx.core::UIComponent/applyState()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UI Component.as:10741]

          at mx.core::UIComponent/commitCurrentState()[E:\dev\4.y\frameworks\projects\framework\src\mx \core\UIComponent.as:10487]

          at mx.core::UIComponent/setCurrentState()[E:\dev\4.y\frameworks\projects\framework\src\mx\co re\UIComponent.as:10323]

          at mx.core::UIComponent/set currentState()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:6425]

          at com.chromeriver.components.matter::MatterSearchBar/setDefaultState()...MatterSearchBar.as :288]