ScrollPane Component
I need t draw a rectangle on a movie clip(board_mc) by dragging mouse over it......It works fine till here but I want to put the movie clip(board_mc) in scrollpane.
but after doing so the code doesnot work....can u plz guide me how to make this code work after placing the movie clip (board_mc) in scrollpane(say board_scp).
var rectDraw:Shape = new Shape();
var corner:Point;
board_mc.addEventListener(MouseEvent.MOUSE_DOWN, setAnchor);
board_mc.addEventListener(MouseEvent.MOUSE_UP, completeRect);
rectDraw.graphics.lineStyle(0, 0, 0);
rectDraw.graphics.beginFill(0X000000);
rectDraw.graphics.drawRect(0,0,13,45);
function setAnchor(e:MouseEvent):void
{
corner = new Point(e.stageX, e.stageY);
rectDraw = new Shape();
board_mc.addChild(rectDraw);
board_mc.addEventListener(MouseEvent.MOUSE_MOVE, liveDrag);
}
function liveDrag(e:MouseEvent):void
{
rectDraw.graphics.clear();
rectDraw.graphics.lineStyle(2, 0X000000); //thickness,color
rectDraw.graphics.drawRoundRect(corner.x, corner.y, e.stageX - corner.x, e.stageY - corner.y,2);
}
function completeRect(e:MouseEvent):void
{
board_mc.removeEventListener(MouseEvent.MOUSE_MOVE, liveDrag);
rectDraw.graphics.lineStyle(0, 0, 0);
rectDraw.graphics.beginFill(0X000000);
rectDraw.graphics.drawRect(corner.x, corner.y, e.stageX - corner.x, e.stageY - corner.y);
}