Hi, Though question here, and props for the person who can
help me here. I have an mxml file and an as 3.0 class that handles the
data. I also use the datamanager classes from Jeff Tapper (http://jeff.mxdj.com/as3_datamanager.htm)
to handle the webservice requests. Here’s some code I use In my Login.mxml: private function fcnSubmitLogin():void { var oLogin:Login = new Login(); oLogin.addEventListener("testEvent",fcnTest); oLogin.performLogin(txtUserName.text,
txtPassWord.text); } private function
testing(event:Event):void { Alert.show("test result"); } In Login.as (which extends EventDispatcher) public function init():void { loginManager =
DataManager.getDataManager(Wsdl.loginWSDL); loginManager.addEventListener("get_accessResponse",fcnAccessResponse); } public function
performLogin(strUserName:String, strPassWord:String):void { loginManager =
DataManager.getDataManager(Wsdl.loginWSDL); loginManager.makeRemoteCall("get_access","get_accessResponse”); fcnTest(); } public function
fcnAccessResponse(event:DataManagerResultEvent):void { fcnTest(); } private function fcnTest():void { Alert.show("in fcnTest"); var e:Event = new Event("testEvent "); this.dispatchEvent(e); } Now, what happens here is the following Login.mxml adds the eventlistener so it listens until
Login.as broadcasts the event “testEvent” The first time it’s working perfectly, the method
performLogin calls fcnTest(), fcnTest dispatches the event “testEvent”,
and I get both alerts (“in fcnTest” from Login.as, and “test
result”, from Login.mxml); Now comes the problem, after the webservice is called, I
get to the method fcnAccessResponse (which is called if access is granted) The method fcnAccessResponse calls fcnTest(), and I get
the alert “in fcnTest” The problem is, fcnTest also dispatches the event “testEvent”,
but it doesn’t get noticed by Login.mxml, whereas the first time the
method is called, it gets triggered. Anyone got a clue? Been searching for hours now… Thanks! -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- [flexcoders] Dispatching an event from inside a resultEvent Jonas Windey