It didn't work with  this.addEventListener either.

Andi

JesterXL wrote:

>Out of curiosity, try changing:
>
>Application.application.addEventListener("test", onTestEvent);
>
>to:
>
>this.addEventListener("test", onTestEvent);
>
>----- Original Message -----
>From: "Andrea Varga" <[EMAIL PROTECTED]>
>To: <flexcoders@yahoogroups.com>
>Sent: Thursday, April 20, 2006 10:52 AM
>Subject: [flexcoders] flex newbie - dispatchEvent question
>
>
>Hi!
>
>I have to mention first that I'm new in Flex.
>I have started to develop a small application using Cairngorm, just to
>get more into it.
>But I have faced  a problem,  my Command is never executed. It seams the
>Event I'm sending is lost somewhere.
>So I made a small test (to see if I'm getting the whole dispatchEvent
>thing):
>Below is my code. The onTestEvent() is never called.
>What am I doing wrong?
>Thanks
>
>Andi
>
><?xml version="1.0" encoding="utf-8"?>
><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
>layout="absolute" applicationComplete="onComplete()">
>    <mx:Script>
>        <![CDATA[
>
>            [Bindable]
>            public var status:String = "";
>
>            public function onComplete():void {
>                status += "Add Event Listener...\n";
>                Application.application.addEventListener("test",
>onTestEvent);
>            }
>
>            public function onTestEvent():void {
>                Application.application.status += "Test Event occured...\n";
>            }
>
>            public function dispatchTextEvent():void {
>                var event:Event = new Event("test");
>                dispatchEvent( event );
>                status += "Event Dispatched...\n";
>            }
>        ]]>
>    </mx:Script>
>
>    <mx:Button x="66" y="56" label="dispatch event"
>click="dispatchTextEvent()" />
>    <mx:TextArea x="66" y="123" width="393" height="243" text="{status}"/>
>
></mx:Application>
>

>


--
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




Reply via email to