How do I stop a timed event from happening?


i making game user clicks on insects , tries high score. when user clicks on 1 insect, insect plays animation , stays in spot 2 seconds in code:

import flash.events.mouseevent; import flash.display.movieclip; import fl.motion.animator; import flash.events.*; play(); var mysound:squish = new squish();  this.addeventlistener(mouseevent.click, kill); this.dead = false; function kill(e:mouseevent):void  {     this.dead=true;     mousechildren=false     mysound.play();     gotoandplay(21);     this.removeeventlistener(mouseevent.click, kill);     flash.utils.settimeout(removeself,2000);  }  function removeself():void {     this.parent.removechild(this); } 

 

when user pauses game, enemies stopped , turn invisible. problem when user clicks on insects, , hits pause button, insects stay there 2 seconds. how remove timer when person pauses game no insects on screen?

use removechild remove insects when game paused:

 

yourinsect.parent.removechild(yourinsect);



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues