On a recent project the client wanted the functionality to have some text labels turn into active links when certain conditions occurred and the rest of the time for them to have no active link. The code is pretty straight forward for doing this, for example you could do.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | protected function checkCondition():void { if ( some_condition_is_true ) { somelabel.buttonmode = true; somelabel.addEventListener(MouseEvent.CLICK, handleClick); } else { somelabel.buttonmode = false; somelabel.removeEventListener(MouseEvent.CLICK, handleClick); } } protected function handleClick(e:MouseEvent):void { // Do something because they clicked on the text label } |
And here is a video of the process with a complete explanation



