homepage Welcome to WebmasterWorld Guest from 54.205.189.156
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Import Photo to Flash
And then be able to click and drag it
dgsk387




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

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();
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

 

eelixduppy




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved