1 Reply Latest reply on Mar 11, 2010 12:18 PM by Sam Souhrada

    adding a child and set to center

    rckehoe Level 1

      I have a very simple script that adds a DisplayObject child to a canvas.... My code is below.

      The only thing I cannot figure out how to do is make it to where the canvas is centered, like you would usually do with horizontalCenter="0" verticalCenter="0" ... For some reason or another, these options are not avaialbe in the actionscript...

       

      Can anyone point me in the right direction?

       

      private function AddNewCustomer():void {
              
              loadCanvas.visible = true;
              
              var AddCustomer:DisplayObject = new customer_form();
              AddCustomer.width = 500;
              AddCustomer.height = 500;
              AddCustomer.x = 50;
              AddCustomer.y = 50;
              
              loadCanvas.addChild(AddCustomer);
              
      }