My account: Login | Sign Up
Loading...

dispatchEvent() trouble... help? | Thread profile

Thread profile page for "dispatchEvent() trouble... help?" on http://www.kirupa.com. This report page is a snippet summary view from a single thread "dispatchEvent() trouble... help?", located on the Message Board at http://www.kirupa.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity, which are reported in a table below. Additional thread profile information is also shown in the following ways:

1) Top Contributing Authors
2) Related Threads on "eBay Auctions"
3) Related Threads on Other Sites

Warning: These statistics are generated using 'best efforts' and can experience delays and reporting errors at times. Please note that such statistics do not constitute a thread's popularity and/or exact posting volumes at any given reporting period.

Title: dispatchEvent() trouble... help?
Site: Kirupa Forum  Kirupa Forum - site profile
Forum: ActionScript 3.0  ActionScript 3.0 - forum profile
Total authors: 3 authors
Total thread posts: 5 posts
Thread activity: no new posts during last week
Domain info for: kirupa.com

Thread posts in dispatchEvent() trouble... help?:

1. 
Started 2 months ago (2008-07-03 17:06:00)  by AmiKaze
Hi! I'm having trouble using the dispatchEvent() method to communicate between two custom classes. The problem is the Main class listens for an event that another class dispatches, but somehow it doesn't 'catch' it... Here is my main class: Code: package { import app.Thumb; import flash.display.Sprite; import flash.events.Event; public class TestLoadThumbs extends Sprite { ...
Size: 2,939 bytes
Customize:  Customize "dispatchEvent() trouble... help? :: ActionScript 3.0 :: Kirupa Forum"
2. 
Started 2 months ago (2008-07-03 17:18:00)  by skineh
Hey there AmiKaze. The problem here is that your listener is set up AFTER the event has been dispatched. ActionScript Code: // The moment you create thumb, its constructor is called and your event is dispatched var thumb:Thumb = new Thumb ( ) ; thumb. y = 50 ; thumb. x = 60 * _thumbCounter; // The listener is added, but your event was already dispatched when ...
Size: 2,823 bytes
Customize:  Customize "<b>Reply 1</b>: dispatchEvent() trouble... help? :: ActionScript 3.0 :: Kirupa Forum"
3. 
Started 2 months ago (2008-07-03 17:23:00)  by AmiKaze
Ahhh, of course... Thanks a lot skineh! My problem is solved!
Size: 117 bytes
Customize:  Customize "<b>Reply 2</b>: dispatchEvent() trouble... help? :: ActionScript 3.0 :: Kirupa Forum"
4. 
Started 2 months ago (2008-07-03 23:45:00)  by dthought
Ah, one other thing. You should create a class for your events and define the event actions as a public static constant. Then if you change your mind about using the string "thumbAdded" later on, you update the constant and your code continues to work. It's the same way we use things like addEventListener(Event.ENTER_FRAME, [...]); instead of addEventListener("enterFrame", [...]); - same ...
Size: 1,666 bytes
Customize:  Customize "<b>Reply 3</b>: dispatchEvent() trouble... help? :: ActionScript 3.0 :: Kirupa Forum"
5. 
Started 2 months ago (2008-07-07 14:33:00)  by AmiKaze
Thanks for the tip dthought! I'll definitely look into it.
Size: 105 bytes
Customize:  Customize "<b>Reply 4</b>: dispatchEvent() trouble... help? :: ActionScript 3.0 :: Kirupa Forum"
 

Top contributing authors for dispatchEvent() trouble... help?

Name Posts
AmiKaze 3
skineh 1
dthought 1