Title: Re: [flexcoders] Events again...

Thanks. I'll give it a try. How about my second question: how can I "propagate" the event up to ClassA (fired in ClassB)?

Regards
RR
--
mobile: +49-(0)170-914-5495
email:   [EMAIL PROTECTED]




-----Original Message-----
From: flexcoders@yahoogroups.com <flexcoders@yahoogroups.com>
To: flexcoders@yahoogroups.com <flexcoders@yahoogroups.com>
Sent: Fri Dec 02 20:32:19 2005
Subject: Re: [flexcoders] Events again...

Ralf -

dispatchEvent and addEventListener are methods of the EventDispatcher
class.  EventDispatcher is the superclass to most (all?) built in flex
components, but is not inherently available to all AS3 classes.

If you modify ClassB to instead be

public ClassB extends flash.events.EventDispatcher, it should run as expected.


At 01:42 PM 12/2/2005, you wrote:
>Again an Event question with desperate need for help:
>
>Talking about Flex 2.0 Alpha.
>Two custom classes: ClassA and ClassB.
>Both .as files, so no MXML, no Component, not derived from any other
>built-in class.
>
>In ClassA you find something like that:
>
>public ClassA
>{
>             private helper:ClassB;
>
>             public function ClassA()
>             {
>                         helper = new ClassB();
>                         helper.addEventListener(“fire”, onCustomEvent);
>}
>
>private function onCustomEvent(_e:Event);Void
>{
>             trace (“Event received.”);
>}
>}
>
>ClassB looks like this
>
>[Event(“fire”)]
>public ClassB
>{
>             // constructor and other stuff
>
>             private function aFunction():Void
>             {
>                         …
>                         …
>                         var e:Event = new Event(“fire”);
>                         dispatchEvent(e);
>
>                         …
>                         …
>             }
>}
>
>Problem: ClassB never receives the event. I am sure the dispatchEvent(e)
>gets called because if I add a listener and a handler in ClassB itself and add
>
>                         var e:Event = new Event(“fire”);
>this.addEventListener(“fire”, onDummyHandler);
>                         dispatchEvent(e);
>
>the onDummyHandler in ClassB gets called as expected.
>
>Your help is more than appreciated – as always.
>
>Best regards
>Ralf
>
>Note: These are not excerpts from my real classes but much more simplified
>versions to illustrate the problem.
>
>Regards
>Ralf
>
>
>
>
>
>
>--
>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.




------------------------ Yahoo! Groups Sponsor --------------------~-->
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/VpTY2A/lzNLAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/





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