Sidenote: instead of subclassing EventDispatcher directly you can also
use the IEventDispatcher interface. This way you don't need to derive
from EventDispatcher:

// pseudo code
class Foo implements IEventDispatcher 
{
  public function Foo()
  {
    dispatcher:EventDispatcher = new EventDispatcher(this);
  }

  // later
  public function dispatchEvent(event:Event):Booleen
  {
    return dispatcher.dispatchEvent(event);
  }
}

Dirk.

________________________________

        From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Ralf Rottmann
        Sent: Saturday, December 03, 2005 12:34 AM
        To: flexcoders@yahoogroups.com
        Subject: RE: [flexcoders] Events again...
        
        

        Just wanted to let you know: Solved the issue. Deriving my AS3
class from EventDispatcher did the trick. However I wonder why Flex
Builder does not offer EventDispatcher as tooltip help when you type

         

        import flash.events.

         

        it offers everything else but not EventDispatcher. Alpha bug?

         

        Regards

         

        Ralf Rottmann 

        ________________________________

                From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Ralf Rottmann
        Sent: Freitag, 2. Dezember 2005 20:57
        To: flexcoders@yahoogroups.com
        Subject: 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
        
        --
        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
<http://groups.yahoo.com/group/flexcoders> " on the web.
                  
        *        To unsubscribe from this group, send an email to:
                 [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
                  
        *        Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service <http://docs.yahoo.com/info/terms/> . 


________________________________


        


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/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/
 


Reply via email to