Flash Actionscript 2对象端的实例名称
如何在当前对象之外使用实例名?我想在该对象命中实例名为-level1的对象时跟踪命中Flash Actionscript 2对象端的实例名称,flash,actionscript-2,Flash,Actionscript 2,如何在当前对象之外使用实例名?我想在该对象命中实例名为-level1的对象时跟踪命中 onClipEvent(load){ var gravity = 9.8; var velocity = 0; var fps = 24; } onClipEvent(enterFrame){ if (this.hitTest(level1)){ trace("Hit"); } else { } velocity = velocity+1/fps
onClipEvent(load){
var gravity = 9.8;
var velocity = 0;
var fps = 24;
}
onClipEvent(enterFrame){
if (this.hitTest(level1)){
trace("Hit");
} else {
}
velocity = velocity+1/fps;
this._y += velocity*5;
}
您需要使用“\u root”作为父级。。。就像您为enter frame函数声明的那样
尝试将hitTest行更改为:
if (this.hitTest(_root.level1)){