Also if you want to create your own onResult "Event" (it's not a real event) you can do this without EventDispatcher or listeners :
class com.boa.projects.iqrcgenerator.components.AdminData{ public var onResult:Function; private var userData:Object; public function wsUserDataByLOB(lobDbId:Number):Void{ var getUserListResult:Object = new Object(); getUserListResult =generatorWebService.GetUserList(lobDbId); getUserListResult.onResult = Delegate.create(this, resultHandler); } private function resultHandler(oUser:object) { // handle the data however you want .. // now trigger the onResult method this.onResult(oUser); } //... the rest of your class below } Now in another class where you import AdminData with say an instance called admData : var admData:AdminData = new AdminData(); admData.onResult = function(oUser) { // your code handling here } As for a method with EventDispatcher, you'll find pretty much what you need with what the others gave you ! :) HTH ! Alain -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: 16 février 2007 10:03 To: Flashcoders mailing list Subject: [Flashcoders] Events for custom classes? OK, I'm pretty good at Actionscript 2.0, but something I never really understood and now need to. Core question: How do I make an event in a custom class, and how do I make a listener in another class listen for the event? EventBroadcaster in the help docs seems to only show how to use it with Adobe classes and components. Docs on listener are the same. I know how to set up listeners for other events, like keypresses and mouse rollovers. Easy enough. But my problem is this (see comments in code below): class com.boa.projects.iqrcgenerator.components.AdminData{ private var userData:Object; public function wsUserDataByLOB(lobDbId:Number):Void{ var getUserListResult:Object = new Object(); getUserListResult = generatorWebService.GetUserList(lobDbId); getUserListResult.onResult = function(oUser){ //this works fine, //I can capture this event result here, //but how do I notify another class? //also what about scope here? //how to set userData as oUser result? //can I fire an event in my AdminData //class from here? } } public function getUserData():Object{ //can't let user get this data //until Webserive event is done. return userData; } } Thanks, Jason Merrill Bank of America Learning & Organizational Effectiveness _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.412 / Virus Database: 268.18.0/689 - Release Date: 2007-02-15 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.412 / Virus Database: 268.18.0/689 - Release Date: 2007-02-15 _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com