Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Import Photo to Flash

And then be able to click and drag it



12:27 am on May 19, 2008 (gmt 0)

5+ Year Member

I want to be able to import an external image file and then click and drag that image around.

Here is the AS3 code I have in the first frame:

var loader = new 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 {
function dropIt(event:MouseEvent):void {
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


5:46 pm on Jul 8, 2008 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Get this working yet? You might get some help from a google search on your issue.

Featured Threads

Hot Threads This Week

Hot Threads This Month