A.ts
class A{
public obj1=null;
public obj2=null;
public o=null;
public run(obj1:egret.DisplayObject,obj2:egret.DisplayObject)
{
var rect1: egret.Rectangle = obj1.getBounds();
var rect2: egret.Rectangle = obj2.getBounds();
rect1.x = obj1.x+160;//xu yao jia cai neng pan duan dong hua
rect1.y = obj1.y;
rect2.x = obj2.x;
rect2.y = obj2.y;
var ao:boolean= rect1.intersects(rect2);
this.o=ao;
}
}
main:
var a = new A();
a.run(kongmingMC,enemy);
//var a = hitTest(kongmingMC,enemy);
if(a.o==true){
this.removeChild(enemy);
}