Shaun, I figured it out - I was in a rush before and didn't take the time to debug. When the eventHandler function is called I was tracing event.currentTarget.id.
In my case event.currentTarget had no properties. It probably would if it extended the EventDispatcher class. Can you give an example of how this is done? Or provide a link to some tutorials? I've searched online and found a few examples. I think the 3rd example on this blog (http://www.darronschall.com/weblog/archives/000100.cfm <http://www.darronschall.com/weblog/archives/000100.cfm> ) is similar to your approach. Thanks for all your help so far. It really cleared up my confusion on event propagation. --- In [email protected], shaun <[EMAIL PROTECTED]> wrote: > > Hi, > > This is the approach i was trying to explain in the previous email. > It was just so your VO doest have to extend EventDispatcher. > Not sure why your getting an id error though.. Perhaps stepping through > the code with the debugger will help. > > > phipzkillah wrote: > > Ok. > > > > I partly have this working. Is this the right (or a valid) approach? > > > > I imagine that will depend on whom you ask? :) > > > > Main.mxml > > > > //init > > globalVO.addEventListener("globalChangeEvent", > > globalChangeEventHandler); > > > > private function globalChangeEventHandler(event:GlobalChangeEvent):void{ > > Alert.show("I heard a global change :)"); > > } > > > > GlobalVO.as > > //instance var > > private var _evtDispatcher:EventDispatcher; > > > > //custom add event listener > > public function addEventListener(evt:String, callBack:Function):void{ > > this._evtDispatcher.addEventListener(evt, callBack); > > } > > > > //dispatches event > > private function dispatchChangeEvent():void{ > > var eventObj:GlobalChangeEvent = new GlobalChangeEvent(this, > > "globalChangeEvent"); > > this._customEvtDispatcher.dispatchEvent(eventObj); > > } > > > I notice that one is called _evtDispatcher and the other > _customEvtDispatcher, not sure if thats the real code or not though or > just example code. > > > > > > > This will give me the following error BUT the event is dispatched and my > > main.mxml hears it. > > > > ReferenceError: Error #1069: Property id not found on > > flash.events.EventDispatcher and there is no default value. > > at main/::globalChangeEventHandler() > > at > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ \ > > tFunction() > > at flash.events::EventDispatcher/dispatchEvent() > > at com.minowireless.reports.vo::GlobalVO/::dispatchChangeEvent() > > at com.minowireless.reports.vo::GlobalVO/set startDate() > > at main/::dispatchDate() > > at main/__startDate1_change() > > at > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ \ > > tFunction() > > at flash.events::EventDispatcher/dispatchEvent() > > at mx.core::UIComponent/dispatchEvent() > > at mx.controls::DateField/::dropdown_changeHandler() > > at > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ \ > > tFunction() > > at flash.events::EventDispatcher/dispatchEvent() > > at mx.core::UIComponent/dispatchEvent() > > at mx.controls::DateChooser/::dateGrid_changeHandler() > > at > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven\ \ > > tFunction() > > at flash.events::EventDispatcher/dispatchEvent() > > at mx.core::UIComponent/dispatchEvent() > > at mx.controls::CalendarLayout/::dispatchChangeEvent() > > at mx.controls::CalendarLayout/::mouseUpHandler() > > > > > > > > regards, > -- shaun >

