Try changing


public function onTestEvent()
to
public function onTestEvent(event:Event)


  You should add event:Event in your listener.





|---------+----------------------------->
|         |                             |
|         |  "Andrea Varga"             |
|         |  <[EMAIL PROTECTED]> |
|         |  Sent by:                   |
|         |  flexcoders@yahoogroups.com |
|         |  04/20/2006 10:52 AM        |
|         |  Please respond to          |
|         |  flexcoders                 |
|         |                             |
|---------+----------------------------->
  >-----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                             |
  |      To: flexcoders@yahoogroups.com                                                                                         |
  |      cc:                                                                                                                    |
  |      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











---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------




--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to