homepage Welcome to WebmasterWorld Guest from
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

5+ Year Member

Msg#: 3653310 posted 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();
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



WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 3653310 posted 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