Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-28-2011, 12:21 AM   PM User | #1
Vizard-Coder
New Coder

 
Join Date: May 2010
Posts: 43
Thanks: 9
Thanked 0 Times in 0 Posts
Vizard-Coder is an unknown quantity at this point
Question Multiple variables on one event?

I want a way to apply a mouse event to multiple button/instance names. Here is the two events that will do the same thing:

Code:
image1.addEventListener(MouseEvent.CLICK, shift);
next2.addEventListener(MouseEvent.CLICK, shift);
Is there anyway to make this into one statement?
Vizard-Coder is offline   Reply With Quote
Old 03-28-2011, 11:21 AM   PM User | #2
[Paul Ferrie ]
Regular Coder

 
Join Date: Nov 2009
Location: Scotland / Glasgow
Posts: 184
Thanks: 1
Thanked 19 Times in 19 Posts
[Paul Ferrie ] can only hope to improve
The adding of events needs to be added to each object but when listening for the event firing you can have one function that handles all the events that where added.
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- Site - Blog - Glasgow Flasher
[Paul Ferrie ] is offline   Reply With Quote
Old 03-29-2011, 03:23 AM   PM User | #3
Labrar
New Coder

 
Join Date: Jun 2008
Posts: 61
Thanks: 0
Thanked 12 Times in 12 Posts
Labrar is an unknown quantity at this point
Its also possible to create an Array in your object. But you have to write a small class for it.

Because you can't overwrite a named listener so easy.
But you can use an object in an object (Objectcontainer). So you're able to add as much behaviors as you want to that listener
Labrar is offline   Reply With Quote
Reply

Bookmarks

Tags
actionscript, event, events, flash, variables

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:46 PM.


Advertisement
Log in to turn off these ads.