It is dispatched like this (in  function in my controller):

dispatchEvent(new GetNewsEvent(GetNewsEvent.GET_NEWS_EVENT, null,  
false, false));

the null is used for an object (if I need to pass data with my event).  
In this particular case I did not.

My actual event class looks like:

package Flexb.events
{
        import flash.events.Event;
        
        public class GetNewsEvent extends Event
        {               
                protected var _data:Object;

                public static const GET_NEWS_EVENT:String="GetNewsEventType";
                
                public function GetNewsEvent( type:String, data:Object = null,  
bubbles:Boolean=true, cancelable:Boolean=false ):void
                {
                        _data = data;
                        super(GET_NEWS_EVENT,true,false);
                }

                public function get data():Object
                {
                        return _data;
                }

        }
}


dnk



On 23-May-08, at 6:16 PM, Josh McDonald wrote:

> What's the event dispatch code look like?
>
>
> On Sat, May 24, 2008 at 11:01 AM, dnk <[EMAIL PROTECTED]>  
> wrote:
> ok, well that explains that part, however either my event is not  
> added, or my event handler is never called. My trace statements  
> never show up....
>
>
> So I guess I  still am wondering if anyone has any ideas....
>
> dnk
>
>
>
> On 23-May-08, at 4:56 AM, Paul Andrews wrote:
>
>> addEventListener() does not return a value..
>>
>> ----- Original Message -----
>> From: "dnk" <[EMAIL PROTECTED]>
>> To: <[email protected]>
>> Sent: Friday, May 23, 2008 12:47 PM
>> Subject: [flexcoders] custom event not added
>>
>> > Hi there,
>> >
>> > I have a controller that is adding my custom event listeners, but  
>> for
>> > some reason my event handler was not being fired.
>> >
>> > My original code was (snippet):
>> >
>> >
>> > (in controler)
>> >
>> > //constructor
>> > public function FlexbController()
>> > {
>> > //turn the key, start it up....
>> > addEventListener( FlexEvent.CREATION_COMPLETE, onInit );
>> > }
>> >
>> > private function onInit( event:Event ):void
>> > {
>> > //setup event listeners
>> > /*systemManager is where event listener hangs out defines the
>> > relationship between event and handler*/
>> >
>> > systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT,
>> > handler_GetNewsEvent );
>> > systemManager.addEventListener( AddNewsEvent.ADD_NEWS_EVENT,
>> > handler_AddNewsEvent );
>> >
>> >  
>> systemManager 
>> .addEventListener( NewsDataLoadedEvent.NEWS_LOADED_EVENT,
>> > handler_NewsLoadedEvent );
>> > getNewsData();
>> >
>> > }
>> >
>> > And I had trace statements in all of my handlers... this is how i
>> > noticed things were not working as they should.
>> >
>> > SO I added a simple check like (in my FlexbController constructor):
>> >
>> > if (systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT,
>> > handler_GetNewsEvent ))
>> > {
>> > trace("true");
>> > } else {
>> > trace("false");
>> > }
>> >
>> >
>> > And I obviously am getting "false".
>> >
>> > Ideas?
>> >
>> > dnk
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > --
>> > Flexcoders Mailing List
>> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> > Search Archives:
>> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!  
>> Groups
>> > Links
>> >
>> >
>> >
>> >
>>
>>
>
>
>
>
>
>
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for  
> thee."
>
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>
> 


------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

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