Welcome visitor
* Login
* Register
It is currently July 23rd, 2019, 2:45 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Flash / ActionScript » ActionScript 3.0



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  trace mouse event on AS3
PostPosted: February 10th, 2009, 7:20 pm 
User avatar

Posts: 52
Hi,

I have two MovieClips, C1 and C2, is there a listener or a mouse function which could tell me which MovieClip was clicked?


Top
 Profile  
 
  Re: trace mouse event on AS3
PostPosted: February 10th, 2009, 7:25 pm 
User avatar

Posts: 40
try this:
ymc1.name = "ymc1";
ymc2.name = "ymc2";

ymc1.addEventListener(MouseEvent.MOUSE_DOWN, ymcCallback);
ymc2.addEventListener(mouseEvent.MOUSE_DOWN, ymcCallback);

function ymcCallback(event:MouseEvent)
{
    switch(event.currentTarget.name)
    {
        case ymc1:
            trace(event.currentTarget.name);
            //Do something here
            break;
        case ymc2:
            trace(event.currentTarget.name);
            //Do something else here
            break;
    }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Flash / ActionScript » ActionScript 3.0


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron