Hi guys...My brain is fry now and I need you guy's help
My last post http://stackoverflow.com/questions/3449725/actionscript-3-simple-drag-question
I am trying to get the scrollBar(videoSlider) dragged to the certain point base on my secondMc(container)
I have X number(dynamic) of small pics in my secondMc and I want my scrollBar stop drag after reach certain point instead of go all the way moving my secondMc to the far left....
My code is as follow:
var singlePictureInsideSecondMcWidth:number=25;
videoSlider.addEventListener(MouseEvent.MOUSE_DOWN, scrollMC);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrollMC);
buildSingleCont(videoResult);
}
private function scrollMC(event:MouseEvent):void{
eventTarget = Object(event.currentTarget);
eventTarget.startDrag(false,new Rectangle(scrollBarX,scrollBarY,contMask.width-eventTarget.width,0));
stage.addEventListener(MouseEvent.MOUSE_MOVE, adjustCont);
}
private function stopScrollMC(event:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, adjustCont);
eventTarget.stopDrag();
}
private function adjustCont(event:MouseEvent):void{
var perct:Number=secondMc.width/secondMcMask.width;
//var maxScroll:Number= Not sure How to do here...
cont.x = -eventTarget.x*perct;
}