Search code examples
actionscript-3scrollmovieclip

Scrolling within AS3 Flash


I'm trying to scroll a movieclip within flash. The problem is I have buttons within the movieClip so everytime I try to scroll its difficult not to open the button. My code is below for the scroll im using which is fairly simple.

ChestBiceps.addEventListener(MouseEvent.MOUSE_DOWN, ClipDraggedOn); 

var boundsRect:Rectangle = new Rectangle(ChestBiceps.x, -200, 0, 310); 

function ClipDraggedOn(event:MouseEvent):void { 

ChestBiceps.startDrag(false, boundsRect); 

stage.addEventListener(MouseEvent.MOUSE_UP, ClipDraggedOff); 

} 

function ClipDraggedOff(event:MouseEvent):void { 

ChestBiceps.stopDrag(); 

stage.removeEventListener(MouseEvent.MOUSE_UP, ClipDraggedOff); }

Could someone try and figure how I disable the buttons almost whilst scrolling? I still want to be able to use the buttons, just not when scrolling...Thanks in advance


Solution

  • To disable the buttons add the following:

            function ClipDraggedOn(event:MouseEvent):void {
    
                ChestBiceps.mouseEnabled = false;
                ChestBiceps.mouseChildren = false;
                [...]
    

    To re-enable the buttons add the following:

            function ClipDraggedOff(event:MouseEvent):void {
    
                ChestBiceps.mouseEnabled = true;
                ChestBiceps.mouseChildren = true;
                [...]