ok, this is how my app is setup....

:: app.mxml ::

has a:

xmlns:controller="Flexb.controller.*"

<controller:FlexbController/>


That is how my controller is instantiated.

:: FlexbController.as ::

public class FlexbController extends UIComponent

in my constructor I have:

addEventListener( FlexEvent.CREATION_COMPLETE, onInit );

then in my onInit function I have:

systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT,  
handler_GetNewsEvent );

along with a call to another function:

getNewsData();

(this one is called without issue).

In that function I dispatch the custom event in question:

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

So when dispatch it should go to a handler function called  
"handler_GetNewsEvent".

And it is that event handler that never seems to be processed. I had a  
trace statement that never seems to show. And in that function there  
are some remoting calls that I never see happening in service capture.

And that is where my app seems to fail.

dnk




On 24-May-08, at 9:09 PM, Alex Harui wrote:

>
> Who’s dispatching and how?
>
>
>
> When does the control get instantiated?  Could it be after  
> creationComplete?
>
>
>
> If the controller is not a UIComponent, it will not get a  
> creationComplete.
>
>
>
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]  
> On Behalf Of dnk
> Sent: Friday, May 23, 2008 4:48 AM
> To: flexcoders@yahoogroups.com
> 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

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