Also keep in mind that events bubble up the display hierarchy, not necessarily your object graph hierarchy, even though they're often closely related. If B is not a direct (display list) descendant of A, A will never receive events bubbled from B, even if A.something.somethingElse.anotherField == B.
-Josh On Wed, Jun 18, 2008 at 9:04 AM, Tracy Spratt <[EMAIL PROTECTED]> wrote: > 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); > } > } > } > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

