Thanks Shaun. Can you explain this better:
"or have an EventDispatcher instance variable and a custom method for attaching an event listener to the instance variable event dispatcher(know what i mean?)." It seems like you would need a public function that main.mxml can call to set the listener (assign it to the EventDispatcher instance variable. But if the listener is set within the GlobalVO class aren't we back to the same issue I'm facing now? Can you provide a quick sample of what you mean? Sorry, I'm fairly new to flex. --- In [email protected], shaun <[EMAIL PROTECTED]> wrote: > > Hi, > > Its probably a good idea to (re)read the dev guide section about working > with events as it may help clear this up for you. The general problem is > that the VO is not part of the parent child hierarchy of the app so it > cant bubble up the chain. > > Your globalVO needs to either (a) dispatch an event on the application > itself(not a good idea) or (b) your application needs to listen to the > globalVO. There are other alternatives aswell but these should be a help > to you right now. > > (a) Application.dispatchEvent("globalChange"); //or similar (in VO). > > (b) globalVO.addEventListener("globalChange", globalVOChangeHandler); > > Option (b) will mean your globalVO will need to be an EventDispatcher > subclass or have an EventDispatcher instance variable and a custom > method for attaching an event listener to the instance variable event > dispatcher(know what i mean?). > > [snip] > > > GlobalVO.as > > package com.test.reports.vo > > { > > import com.test.reports.events.GlobalChangeEvent; > > import flash.events.EventDispatcher; > > > > public class GlobalVO > > { > > private function dispatchChangeEvent():void{ > > var eventObj:GlobalChangeEvent = new > > GlobalChangeEvent(this, "globalChangeEvent"); > > var dispatcher:EventDispatcher = new EventDispatcher(); > > dispatcher.dispatchEvent(eventObj); > > } > > > > public function set someValue(val:String):void{ > > dispatchChangeEvent(); > > } > > FYI. There is a property_change event(or some similar name) that makes > this pretty easy. eg) > > class Foo{ > > var x:Number=0; > > funciton Foo(){ > addEventListener(PropertyChangeEvent.propertyChange, > handlePropertyChange); > } > > function handlePropertyChange(e:PropertyChangeEvent):void{ > if (e.property == "x" || e.property == "y"){ > //do something. > } > } > > } > > HTH. > -- shaun >

