2 Replies Latest reply on Jul 18, 2011 3:17 AM by EvyatarBH

    Show and hide buttons

    W M Chin Level 1

      Hi everyone,


      I have created a viewstack that shows some text in a text area.  It goes to the next textarea when I click the next button and the previous textarea when I click the previous button.  What I want to do is that when it gets to the first textarea, it must hide the previous button (set its visible property to false) and then when it gets to the last textarea to hide the next button (set its visible property to false).  I tried it here below but it's not working, please can you help me solve my problem:


      private function tipsResult(event:ResultEvent) {

      tips = event.result as Array;


      for each (var str:String in tips) {

      var textarea:TextArea = new TextArea;

      textarea.percentHeight = 100;

      textarea.percentWidth = 100;

      textarea.editable = false;



      textarea.text = str;

      var can:Canvas = new Canvas;

      can.percentHeight = 100;

      can.percentWidth = 100;




      viewstack.selectedIndex = 0;



      private function viewPrevTip() : void {

      if(viewstack.selectedIndex != 0)

      viewstack.selectedIndex -= 1;


      if(viewstack.selectedIndex == 0)




      private function viewNextTip() : void {


      if(viewstack.selectedIndex < (viewstack.numChildren -1))

      viewstack.selectedIndex += 1;


      if((viewstack.selectedIndex + 1)== viewstack.numChildren)