|
You're not adding the TestHandler object as a listener of
the TestDispatcherClass object. Your code is actually registering to
itself. Also, you probably shouldn't dispatch an event from the
constructor, since that runs before anything else you won't be able to add a
listener before your constructor dispatches the event. Try
this:
package com.test
{
import flash.display. import flash.events. public class TestDispatcherClass extends Sprite { public function runDispatch() { dispatchEvent( } } } package com.test {
import mx.controls. import flash.display. import
com.test.TestDispatcherClass;
public class TestHandler extends Sprite { public function TestHandler(dispatcher:TestDispatcherClass dispatcher.addEventListen } public function actionHandler( Alert.show(" } } } <mx:Application xmlns:mx="http://www.adobe.
layout="absolute" xmlns="*" creationComplete= <mx:Script> <![CDATA[ import com.test.TestHandle import com.test.TestDispat private var test:TestHandler; private var dispatcher:TestDisp private function initApp():void { dispatcher = new TestDispatcherClass test = new
TestHandler(this.dispatcher
dispatcher.runDispatch();
} ]]> </mx:Script> </mx:Application> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of efeminella Sent: Monday, July 10, 2006 10:12 PM To: [email protected] Subject: [flexcoders] Re: Simple Event Listener Examples between 2 classes Yeah, I have read the documentation for the new event model but I
am -- 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
|
- RE: [flexcoders] Re: Simple Event Listener Examples betwee... Danny Patterson

