I might be getting it wrong but the following might help:

In working with components and using "placed onscreen in editor"
components, I always find myself needing to wait 1 frame before adding
the component event listeners. It seems the v2 components need 1
enterframe to fully initialize themselves.

The way I do it (very crude code, in no sense useable in a copy paste
sense)


Private function onEnterFrame() {
        // Create this handler, which if all goes well
        // will be called only once, but we know 100% sure
        // we had at least 1 frame interval.
        addHandlers();
} 

Private function addHandlers() {
        // Clean up the onEnterFrame
        delete this.onEnterFrame;

        // Add all listeners here
        myComponent.addEventListener("click", this);
}




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wade
Arnold
Sent: dinsdag 7 november 2006 3:31
To: 'Flashcoders mailing list'
Subject: [Flashcoders] Where to add eventListners in UIComponent
classes?

I have a component that has a couple Macromedia UI components used
inside of it. I have found that if I add my event listeners inside of
createChildren after I have added the UI components the events are not
added. I have also tried to add the events inside of the draw method. In
order to get the events to work properly I have to add them into my
onLoad() method. However this makes it so when I load the component I do
not get an accurate onLoad event from the component as the event
handlers have yet to be registered. Is there someplace that I am missing
that I should be placing all of my event registration in anything that
extends UIComponent? 

 

Thanks;

Wade Arnold 

 

 

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to