Hi, remove the quotes from your true and false values. The visible property is a boolean property. Your non empty strings ("true"/"false") will type coerce to true.
Lars http://www.flexceptional.com On Mon, Jul 18, 2011 at 11:41 AM, chinwesley <wesleyc...@hotmail.com> wrote: > ** > > > 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.setStyle("verticalScrollPolicy","true"); > textarea.setStyle("backgroundColor","#EBEBEC"); > textarea.text = str; > var can:Canvas = new Canvas; > can.percentHeight = 100; > can.percentWidth = 100; > can.addChild(textarea); > viewstack.addChild(can); > } > viewstack.selectedIndex = 0; > } > > private function viewPrevTip() : void { > if(viewstack.selectedIndex != 0) > viewstack.selectedIndex -= 1; > > if(viewstack.selectedIndex == 0) > previous.visible="false"; > } > > private function viewNextTip() : void { > > if(viewstack.selectedIndex < (viewstack.numChildren -1)) > viewstack.selectedIndex += 1; > > if((viewstack.selectedIndex + 1)== viewstack.numChildren) > next.visible="false"; > > previous.visible="true"; > } > > >