当所有 mc 都放在主时间线(舞台)上时,我的代码工作正常但是,当我将它们导入到名为Container_Mc的单个电影剪辑中时,代码停止工作。我确定它与目标/深度有关
这是在时间线上工作的代码
stop ();
first = 1;
import mx.transitions.Tween;
import mx.transitions.easing.*;
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
if (eval(this._droptarget) == targ) {
var tx:Tween=new Tween(this,'_x',Elastic.easeOut,this._x,this.myFinalX,1,true);
var ty:Tween=new Tween(this,'_y',Elastic.easeOut,this._y,this.myFinalY,1,true);
targ.gotoAndStop(2);
} else {
var tx:Tween=new Tween(this,'_x',Elastic.easeOut,this._x,this.myHomeX,1,true);
var ty:Tween=new Tween(this,'_y',Elastic.easeOut,this._y,this.myHomeY,1,true);
targ.gotoAndStop(2);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
}
dragSetup(drag1,target1)
dragSetup(drag2,target2)
dragSetup(drag3,target3)
btn.onRelease = function() {
if ((_root.drag1._droptarget == "/target1") && (_root.drag2._droptarget == "/target2") && (_root.drag3._droptarget == "/target3")) {
if (first == 1) {
first = 0;
result +=
}
comment = "Great! correct answer";
_root.attachMovie("glamour", "glamour2", 202);
_root.glamour2._x = 226;
_root.glamour2._y = 153;
} else {
comment = "try again!!";
first = 0;
}
}
我很确定问题出在BTN FUNCTION中的IF 语句中,因为上面的其余代码在Container_Mc中导入时可以正常工作,它只是 if 语句,即使目标正确,也会返回 else“再试一次”答案?
任何人有任何想法?