PDA

View Full Version : detect if movieclip is outside the stage


ThreeDollarBill
08-04-2009, 01:04 PM
i am making a simple "tank-type" game in flash using Actionscript 3..
the gun rotates according to the where the mouse is and it also fires bullets (which are movieclips dynamically added from the library)...

i would like to know the simplest way of detecting if the bullets are already outside the stage so i can call removeChild and remove them...

Confus
08-04-2009, 07:19 PM
Dont know bout simple but i use
if ((this.x > stage.stageWidth) || (evt.target.x < 0)) {
destroyBullet();
} else if ((this.y > stage.stageHeight) || (evt.target.y < 0)) {
destroyBullet();
}
}