【发布时间】:2014-07-22 19:05:32
【问题描述】:
在我的actionscript 3 类中,我放置了一个名为oldX 的私有属性来保存MovieClip 的初始位置。
当一个实例拖到另一个实例上时,这些属性会意外更改。
public class Piece extends MovieClip {
private var oldX:Number;
private var oldY:Number;
public function Piece() {
//...
oldX = this.x;
oldY = this.y;
//action listeners
}
public function startDragging(evt:MouseEvent) { evt.startDrag(true); }
public function stopDragging(evt:MouseEvent) {
evt.stopDrag();
//when one Piece instance drags on another instance
trace(oldX); //these are not the original values at this moment
trace(oldY); //these are not the original values at this moment
}
}
请您解释一下为什么会这样。
【问题讨论】:
标签: actionscript-3 flash animation actionscript