This seems to work reliably for simple decoration and composition into homemade widgets. Don't know if it will help you with building Adobe style 'components'...

function makeBtn():Void
{
   btnV2 = Button(btn_mc.attachMovie("Button", "btnV2", 0));
   if (btnV2.initializing == true){
       btnV2.watch("initializing", handleWatch, this);
   } else {
       onInt();
   }
}

private static function handleWatch(prop, oldVal, newVal, instance):Boolean
{
   if (newVal == false) instance.onInt();
   return newVal;
}

private function onInt():Void
{
   btnV2.addEventListener('click', doStuff);
   btnV2.setSize(WIDTH, HEIGHT);
   btnV2.enabled = true;
   ...
   btnV2.unwatch("initializing");
}

Tony
_______________________________________________
[email protected]
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