Forum Moderators: open
Here is the AS3 code I have in the first frame:
var loader = new Loader();
square_mc2.addChild(loader);
loader.load(new URLRequest("images/image1.jpg"));
square_mc2.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
square_mc2.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
event.target.parent.addChild(event.target);
}
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget) {
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
}
}
square_mc2.buttonMode = true;
That code allows me to click and drag around the square_mc2 Movie Clip and it also imports an image for that clip. ***I want the image to cover the entire movie clip and then be able to drag that image around. The problem I have is the image itself isn't clickable... I have to leave a small portion of the Movie Clip exposed so I can click the MOVIE CLIP and move it and the image around.
How can I fix this?
Many thanks