Re: [flexcoders] flex newbie - dispatchEvent question
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 -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] flex newbie - dispatchEvent question
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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] flex newbie - dispatchEvent question
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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] flex newbie - dispatchEvent question
Yes, this has solved it Thanks [EMAIL PROTECTED] wrote: Try changing public function onTestEvent() to public function onTestEvent(event:Event) You should add event:Event in your listener. -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] flex newbie - dispatchEvent question - Part 2
Well, this worked, but in the Cairngorm framework this was correct and the problem is somewhere else. Below is my new little test. This time the button that does the dispatchEvent is not in the application, but inside another component The Main.mxml code is almost the same as before, just the Login component is new. The button with Login1 has the same code as the Login2 button inside the Login component (both dispatch a test event). But the Application catches just the Login1 event. What am I mmissing this time? ?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(event:Event):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=Login1 click=dispatchTextEvent() / mx:TextArea x=66 y=123 width=393 height=243 text={status}/ Login x=333 y=56 / /mx:Application The Login.mxml code: ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml xmlns=* mx:Script ![CDATA[ public function loginUser():void { var event:Event = new Event(login); dispatchEvent( event ); Application.application.status += Dispatch login event...\n; } ]] /mx:Script mx:ControlBar mx:Button label=Login2 click=loginUser() / /mx:ControlBar /mx:Canvas [EMAIL PROTECTED] wrote: Try changing public function onTestEvent() to public function onTestEvent(event:Event) You should add event:Event in your listener. -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] flex newbie - dispatchEvent question
If you are using a debugging version of the player, this would have caused an runtime exception alert when onTestEvent() was passed an argument that it wasn't expecting. - Gordon -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrea Varga Sent: Thursday, April 20, 2006 11:33 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] flex newbie - dispatchEvent question Yes, this has solved it Thanks [EMAIL PROTECTED] wrote: Try changing public function onTestEvent() to public function onTestEvent(event:Event) You should add event:Event in your listener. -- 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 -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.