3 Replies Latest reply on Jun 28, 2007 3:32 PM by ov.c

    get the width of the parent

    ov.c
      Hello

      I'm trying to position a button on the right side of a canvas ( like using the "right" property in MXML ).
      The canvas has the width and height in percent ( 100%, 100% ). I think I need for this to get the width of the canvas, right?
      Worked only if the width and height of the canvas is set in absolute values.
      If I run Alert.show(myButton.parent.width.toString()) I get 0 when the width is 100%.

      var dp:Canvas = new Canvas();
      with (dp) {
      percentWidth = 100;
      percentWidth = 100;
      var submitBtn:Button = new Button();
      submitBtn.label = "Submit";
      addChild(submitBtn);
      }

      Hope someone know why is not working
      Thank you

      PS: both button and canvas created in AS