Select to view content in your preferred language

Listen to an event in a class from component

555
0
06-15-2011 06:15 AM
PeteVitt
Frequent Contributor
Hi - I'm trying to dispatch an event in an actionscript class and listen to that event in a component.  What I've got on the class side is this
Package Mainentance
{
[Event(name="SetReachData", type="flash.events.Event")]
public class FindMaintFac_DB
     import flash.events.Event;
     import flash.events.EventDispatcher;
     ...etc
protected function onReachSearchSuccess(event:ResultEvent):void
  {
...
arrCollReachData=event.result as ArrayCollection;
dispatcher.dispatchEvent(new Event("SetReachData"));
}

Trouble on the Component side:
I'd like to listen for the event in the creationcomplete function:
private function OnCreationComplete():void
  {
   findMaintFac_DB= new FindMaintFac_DB(ddlReach);
   findMaintFac_DB.GetReaches();
   ????MHGraphicsLayer.addEventListener????
   }

the GetReaches function pulls data from the database, onReachSearchSuccess puts data into an arraycollection, and I'd like to pass that arraycollection back to the component -- GetReaches is asynch so I think I need the event to get raised when its complete and then set a property for the Arraycollection which the component can grab

Thanks

Pete
Tags (2)
0 Kudos
0 Replies