2 Replies Latest reply on Oct 21, 2010 4:54 PM by fuyuko1979

    include component in state with AS3


      Hi I have a tab navigator that I instantiate in my AS3 code.  I want to make this tab navigator only show in some states but not all. How do I do this?  Obviously with mxml I can add a "includeIn" property and assign which states it should be visible but how would I do this in ActionScript?   thank you, fuyuko

        • 1. Re: include component in state with AS3
          drkstr_1 Level 4

          States are an MXML concept, not an AS concept. In AS, you would use whatever logic you would use to change your state, and then do the stuff you want to happen then.


          override public function set currentState(value:String):void


            super.currentState = value;

            //do stuff with a bunch of mess conditionals



          The above just doesn't seem natural.


          If you are interesting in creating state-like functionality in native AS, you may want to look into the Memento Pattern.

          • 2. Re: include component in state with AS3
            fuyuko1979 Level 1

            Hi drkstr_1 thanks for your reply. Yes I guessed that was the case and ended up just instantiating a tab navigator in mxml and then adding a child to each tab in run time. In this way I can control which states the tab navigator shows in.   thanks again.