Hmmm, this is the way I have done it - but my event handler is not firing. I am dispatching my DynamicEvent from a Cairngorm command - in the execute method I have:
var evt:DynamicEvent = new DynamicEvent("initCompleted"); dispatchEvent(evt); in my module's creationComplete handler I have this code: this.addEventListener("initCompleted",initCompletedHandler); Then in the module's script block I have the event handler private function initCompletedHandler(event:DynamicEvent):void{ } This handler never gets hit. --- In flexcoders@yahoogroups.com, "Nate Beck" <n...@...> wrote: > > It's exactly the same as a standard Event. As you can see in the Language > Reference ( > http://livedocs.adobe.com/flex/3/langref/mx/events/DynamicEvent.html): > > var event:DynamicEvent = new DynamicEvent("credentialsChanged"); > event.name = name; > event.passsword = password; // misspelling won't be caught! > dispatchEvent(event); > > then.. > > module.addEventListener("credentialsChanged", myHandler); > > The DynamicEvent class works exactly like and Event... it just gives > you the ability to add properties to it at runtime. If you're going > to be using the same event over and over again. You're better off > just creating a custom event > (http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_1.html#110674). > > "If you do not identify an event in the class file with the [Event] > metadata tag, the MXML compiler generates an error if you try to use > the event name in MXML. Any component can register an event listener > for the event in ActionScript by using the addEventListener()method, > even if you omit the [Event] metadata tag." > > HTH, > > Nate > > On Mon, Jan 12, 2009 at 11:07 AM, flexcoder2008 <djohnso...@...>wrote: > > > I have seen numerous examples of registering a dynamicEvent in a > > component's mxml such as: > > > > [Event (name="rowSelected", type="mx.events.DynamicEvent")] > > > > If I have an actionscript class that dispatches a dynamicEvent, what > > is the syntax for this? > > > > I want to dispatch a dynamicEvent from an actionscript class, and I > > want my module to listen for that event. > > > > > > > > > > -- > > Cheers, > Nate > ---------------------------------------- > http://blog.natebeck.net >