Welcome visitor
* Login
* Register
It is currently July 24th, 2019, 5:06 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
  Use the same function for different objects
PostPosted: February 10th, 2009, 8:14 pm 
User avatar

Posts: 61
Hi,
Im designing an animation with many buttons and other objects, and i want them to do the same 'action', like all the buttons do the same, and so on, so im looking for the easiest way to do it , any suggestions?
This is the code for one button:
button1.addEventListener(MouseEvent:MOUSE_DOWN, drag);
function drag (event:MouseEvent):void
    {
       button1.startDrag();
    }

thanks.


Last edited by bob on February 10th, 2009, 8:27 pm, edited 1 time in total.

Top
 Profile  
 
  Re: Use the same function for different objects
PostPosted: February 10th, 2009, 8:26 pm 
User avatar

Posts: 63
see if this works:
function drag (event:MouseEvent):void
{
   Sprite(event.currentTarget).startDrag();
}


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