Inside a canvas I have a timer that I only want to run while that canvas is visible.聽 I tried the addededToStage and removedFromStage events which started the timer as soon as I launched the app.聽 I figured this must be a pretty common thing to do so rather than trying every event that souds like it might work and maybe getting lucky I would just ask.
Thanks!
Running a timer only when the...How do you change the visible status of your Canvas? If it's for example by some user-action (f.e. Button-Click) you can simply add a start/stop-Timer call to that...But I think you change it in a different way, don't you?
Running a timer only when the...Yeah, a button click is out of the question.聽 It is the main page in a module and there are a 1000 ways in and out of it.聽 I really need to key on some event.聽
Found the answer.聽 The DisplayObject has a boolean property called strangely enough ''visible''.聽 So I can do something like this:
private function myTimerEventHandler(event:TimerEvent):void{
聽聽聽聽 if(this.visible){
聽聽聽聽聽聽聽聽聽 //do whatever
聽聽聽聽 }
}聽聽
No comments:
Post a Comment