我正在尝试创建一个滚动条... videoSlider 是我的滚动条,我想拖动它,以便我的第二个MC 将移动....在我的代码中一切正常,但如果我在我的videoSlider 中将鼠标向下并在它之外。 ...拖动状态仍然适用,这不是我想要的....有什么想法吗?谢谢...
videoSlider.addEventListener(MouseEvent.MOUSE_DOWN, scrollMC);
videoSlider.addEventListener(MouseEvent.MOUSE_UP, stopScrollMC);
var eventTarget:Object; // to allow more global access to the dragged object
function scrollMC(event:MouseEvent):void{
eventTarget = Object(event.currentTarget);
eventTarget.startDrag(false,new Rectangle(0,0,500,0));
stage.addEventListener(MouseEvent.MOUSE_MOVE, adjust2ndX);
}
function stopScrollMC(event:MouseEvent):void{
eventTarget.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_MOVE, adjust2ndX);
}
function adjust2ndX(evt:MouseEvent):void {
secondMC.x = eventTarget.x;
}