views:

17

answers:

1

Hi guys....

I am trying to create a mc with drag function.My question is how to change another movieclip's x value when I drag my first mc...

videoSlider.addEventListener(MouseEvent.MOUSE_DOWN, scrollMC);
videoSlider.addEventListener(MouseEvent.MOUSE_UP, stopScrollMC);

    private function scrollMC(event:MouseEvent):void{
        event.target.startDrag(false,new Rectangle(0,0,500,0));
        secondMC.x =event.target.x; //this doesn't work.....
    } 
    private function stopScrollMC(event:MouseEvent):void{
        event.target.stopDrag();
    }

Thanks for any help!

+1  A: 

Hi,

A solution could be to start an EnterFrame when you start drag first MC. You will stop the EnterFrame event when you stop dragging firstMc.

function onEnterFrame(e:Event):void{
    secondMc.x=firstMc.x;
}

You could also override the x setter of the first MC...

override public function set x(value:Number):void{
   super.x=value;
   secondMc.x=value;
}
OXMO456