I suspect when you mention that move() is not working then you are trying to invoke this on the Button components from within createChildren() . This will also not work as child UIObject components are not fully initialised until the next frame.

UIObject has a doLater() function which will defer any method call to the next frame. So you could do something like this....

function createChildren () : Void
{
   // do something here

   doLater(this, "layoutComponents");
}

// invoked on the next frame
function layoutComponents () : Void
{
   myUIObjectComponent.move(100, 50);
}


mx.core.View does something similar to this: you would layout components in a doLayout() method which is automatically deferred called on the next frame.

You could of course declare a draw() method instead.

Chris



David Ham:
Hi,

I was having trouble with some components yesterday. I am writing a
NavigatonView class that extends UIObject. I linked it to a symbol in the
library that had four Button components in it. The symbol had no code in it;
the code for the class was entirely in an external .as file.

Here is the trouble: the Button components appear on stage, but only as
Movieclips, they do not respond to component commands like move(), and they
do not register calls to addEventListener(). However, they respond visually
when I roll over them, and I can attach functions to their onRelease. What
gives?

Here is the code from the class:

    private function createChildren():Void {
        trace("CREATECHILDREN");
        roomShape_btn.toggle = true;
        //roomShape_btn.addEventListener( "click", this );
        //resizeRoom_btn.addEventListener( "click", this );
        //editCorners_btn.addEventListener( "click", this );
        //placeObjects_btn.addEventListener( "click", this );
        roomShape_btn.onRelease = click;
        resizeRoom_btn.onRelease = click;
        editCorners_btn.onRelease = click;
        placeObjects_btn.onRelease = click;
} function click(evt:Object) {
        trace( this );
    }

The commented lines do not work (and yes, I did try uncommenting them first,
har har) but the onRelease ones do.

Incidentally, component instances that I create dynamically with
createClassObject() work as expected.

Thanks for any help you can offer,

OK
DAH



_______________________________________________
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