Hi Paul, So I'm putting my event listener in the application core. What I would like is for this event to enter the event stream and bubble up to the application core. Currently, it doesn't look like it even makes it out of the document that I'm in. I'm not even sure that it gets populated outside of the class itself.
What i'd really like is to have this event entered automatically into the event stream with out having to have an event repeater. --- Paul Williams <[EMAIL PROTECTED]> wrote: > Hi Jon, > > Sprite extends EventDispatcher, so you don't need to > instantiate another > EventDispatcher in your class. > > Instead, try the following: > > this.dispatchEvent(new > Event("AuthenticationFailed",true,false)); > > If you still have problems can you let us know what > object you are > creating your event listener on? > > Paul > > -----Original Message----- > From: flexcoders@yahoogroups.com > [mailto:[EMAIL PROTECTED] On > Behalf Of Jon Hirschi > Sent: Thursday, June 22, 2006 9:45 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] how do you dispatch event from > a custom class? > > > I have a custom class that I want to be able to > dispatch an event. However, it's not entering the > event into the event stream, I don't even think the > event is getting out of the class. I have bubbles > set > to true. does anyone know how to get the event > entered into the event stream... the docs aren't > very > explicit on this subject.... > > ie > > code to call my class... > > private function > handleLBResponse(eventObj:ResultEvent):void { > var tempArray:Array; > var checkResult:WebServiceCheck = new > WebServiceCheck(); > if > (checkResult.checkServiceReturnStatus(eventObj,true)) > > { > tempArray = > mx.utils.ArrayUtil.toArray(eventObj.result.lbvServerTos); > if (tempArray.length > 1) { > dpLBVServerData.source = > tempArray; > } else { > > dpLBVServerData.removeAll(); > } > } else { > dpLBVServerData.removeAll(); > } > > } > > > > > ------------------------------ > code in the class > > ----------------------------------- > > package comp.webconfig.services { > > import flash.display.Sprite; > import mx.rpc.events.ResultEvent; > import mx.controls.Alert; > import flash.events.Event; > import flash.events.EventDispatcher; > > public class WebServiceCheck extends Sprite { > > > > public var isSuccess:Boolean; > public var statusType:String; > public var message:String; > public var rawMessage:String; > > public function WebServiceCheck() { > > } > > public function > checkServiceReturnStatus(resultToCheck:ResultEvent,alertOnError:Boolean= > false):Boolean > { > var myMessage:String; > var isSuccess:Boolean = true; > var myRawMessage:String; > var myRawStatus:String; > var dispatcher:EventDispatcher = new > EventDispatcher(); > if (resultToCheck.result != null) { > if (resultToCheck.result.requestMessage > != null) > { > myRawMessage = > resultToCheck.result.requestMessage; > } > if (resultToCheck.result.requestStatus) > { > myRawStatus = > resultToCheck.result.requestStatus; > } > } > if (myRawStatus != null) { > switch (myRawStatus) { > case "Failed" : > // do something here > like popup a message > myMessage = "Sorry, > there was an error trying to > access the information you requested. \n\n" > myMessage += > myRawMessage; > isSuccess = false; > break; > case "Unauthorized" : > // do something here... > like popup a message > myMessage = "Sorry, you > were not authorized to > access the information you requested. \n\n" > myMessage += > myRawMessage; > isSuccess = false; > break; > case "AuthenticationFailed" : > > dispatcher.dispatchEvent(new > Event("AuthenticationFailed",true,false)); > myMessage = "Sorry, you > are either not Logged > in, or you have been logged out. \n\n" > myMessage += > myRawMessage; > isSuccess = false; > trace("this person is > unauthorized"); > break; > default : > // do nothing because > they should be fine here. > // this should be a > success > myMessage = "Results > returned successfully"; > break; > } > } else { > // do nothing here because we are > guessing that > this was a successful addition > } > if (!isSuccess && alertOnError) { > showErrorMessage(myMessage); > } > > this.isSuccess = isSuccess; > this.statusType = myRawStatus; > this.message = myMessage; > this.rawMessage = myRawMessage; > > return isSuccess; > } > > public function > showErrorMessage(message:String):void { > mx.controls.Alert.show(message,"Error Requesting > data from server"); > } > } > } > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > > > > -- > Flexcoders Mailing List > FAQ: > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > === message truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/