homepage Welcome to WebmasterWorld Guest from 54.205.14.21
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
event.target problem
dgsk387




msg:3702662
 9:23 pm on Jul 19, 2008 (gmt 0)

I've read that you can use the following code so that several different movie clips could use the same function:

function pickUp(event:MouseEvent):void {
event.target.startDrag();
}

But that doesn't work for me. It only works if I specify the actual movieclip name such as:

function pickUp(event:MouseEvent):void {
myMovieClip.startDrag();
}

Does anyone know why the first snippet doesn't work? I really want to be able to use that so I don't have to have several dozen functions that do the same thing.

 

eelixduppy




msg:3718508
 2:14 pm on Aug 8, 2008 (gmt 0)

Don't know. How's this coming along?

chronic




msg:3723457
 12:45 am on Aug 15, 2008 (gmt 0)

Try using currentTarget. Some more details would be helpful, like whether there are children of the movie clip?

dgsk387




msg:3723529
 3:27 am on Aug 15, 2008 (gmt 0)

Holy crap, that worked perfectly chronic!

THANK YOU

function pickUp(event:MouseEvent):void {
event.currentTarget.startDrag();
}

function dropIt(event:MouseEvent):void {
event.currentTarget.stopDrag();
}

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