Unless a listener is assigned directly to the dispatching component, you need to set the "bubbles" argument when you dispatch the event
dispatchEvent( new MyEvent (MyEvent.RESULT,true) ); Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of LazerWonder Sent: Tuesday, June 17, 2008 6:26 PM To: [email protected] Subject: [flexcoders] Question regarding EventDispatcher Here's the scenerio: - In a component, I'm dispatching an event. Let's call it: "MyEvent" - In the main application, there is an EventDispatcher that's listening for the component event. None of this is Cairnogorm for many reasons. (Although I have nothing against that framework). However, this is not working. Would someone be able to explain why and how I can go about solving this? Thanks! === Sample code: (Assume all imports are there). === public class MyClass extends EventDispatcher { //stuff public function myFunction():void { //more stuff... then... this.addEventListener (MyEvent.EVENT_GOOD, doGood); this.addEventListener (MyEvent.EVENT_BAD, doBad); var test:TestComponent = new TestComponent(); } public function doGood(e:MyEvent):void { //do other stuff } public function doBad(e:MyEvent):void { //do stuff } } --- In component: package com.mystuff.test { public class TestComponent { public function TestComponent() { //do stuff here var t:TestDispatcher = new TestDispatcher(); t.dispatchMyEvent(); } } } package com.mystuff.test { public class TestDispatcher extends EventDispatcher { public function TestDispatcher() { super(); } public function dispatchMyEvent():void { dispatchEvent( new MyEvent (MyEvent.RESULT) ); } } } package com.mystuff.test.events { public class MyEvent extends Events { public static var EVENT_GOOD= "goodStuff"; public static var EVENT_BAD = "badStuff"; public function MyEvent (type:String) { super(type); } } }

