| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Senior Member
Join Date: Dec 2006
Posts: 967
|
What I was wondering about, was when naming one of my own events, how do I best ensure the name of my event never conflicts with an existing name?
For example: ActionScript Code:
How can I be certain there is not already an event named "wonGame?" To see if there was a convention, I ran this: ActionScript Code:
activate click progress Which doesn't indicate any way to guarantee an event name is unique other than going through Event and all its descendants for every single static constant to see if it's been used. |
|
|
|
|
|
#2 |
|
Joeri Sebrechts
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,462
|
Since the event name is just a string, you can start it with something unique to yourself or your project: "com.somedomain.someapp.someevent".
|
|
|
|
|
|
|
|
|
#3 |
|
flash veteran
Join Date: May 2005
Location: Belgium
Posts: 900
|
Why would you need a unique event String? They do not conflict. You can have for example a LoadingEvent.COMPLETE and a PlayingEvent.COMPLETE
In reality both strings will be equal ("complete") but it doesn't matter since in one case you'll be listening for a LoadingEVent and in the other for a PlayingEvent |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Dec 2006
Posts: 967
|
Okay, so I would have stuff like:
ActionScript Code:
ActionScript Code:
ActionScript Code:
Last edited by rrh; 01-30-2008 at 05:30 PM.. |
|
|
|
|
|
#5 | |
|
flash veteran
Join Date: May 2005
Location: Belgium
Posts: 900
|
Quote:
|
|
|
|
|
|
|
#6 |
|
AS3
|
I believe that key is at dispatch event method.You are distatching event of specified type, so AV2 can check type of dispatched event, and filter only those who match specified type. Now it has list of pairs eventHandlerFunction/eventType (String), so is just matter to check with ones fit, and call proper function.
|
|
|
|
|
|
#7 | |
|
Senior Member
Join Date: May 2003
Location: berlin
Posts: 361
|
Quote:
//b. |
|
|
|
|
|
|
#8 |
|
AS3
|
Type checking
ActionScript Code:
|
|
|
|
|
|
#9 | |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Quote:
So, it's just experience and to be knowledgeable about your surroundings.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| KEY_UP events missing | aerosoul | ActionScript 3.0 | 5 | 05-29-2008 07:39 AM |
| KB Events / Focus upon re-entry to html window | Spire | ActionScript 3.0 | 0 | 12-30-2007 11:28 PM |
| Timer and Events not reliable? | jsimpson | ActionScript 3.0 | 5 | 06-06-2007 10:00 PM |
| Assigning Multiple Events to One Function | timothy | ActionScript 2.0 | 1 | 04-11-2006 10:17 PM |
| Missing events for components? | Denaes | Components | 0 | 10-05-2003 05:04 PM |