5 Replies Latest reply on May 27, 2010 7:53 AM by Cat Pee

    Custom button that creates another object in its parent

    Cat Pee

      I have a function that creates an instance of a custom class extending Button inside of a BorderContainer using MyBorderContainer.addElement().  It seems to be working fine.  What I would like is for the custom button (of which there will be several created) to be able to create a panel inside of the same BorderContainer.  Here is the class for the custom button:

       

      [quote]public class MySpecialButton extends Button

           {

           private var NewPanel:Panel = new Panel();

           public function MySpecialButton()

                {

                this.setStyle("skinClass",MySpecialButtonSkin);

                }

           override protected function clickHandler(event:MouseEvent):void

                {

                this.parent.addChild(NewPanel);

                }

           }[/quote]

       

      I don't get any errors or warnings, it just seems to get hung up at the addChild line.  I've been working on this same problem for quite a while now and I'm stuck.  Any ideas?