A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to get the real width of a button?

  1. #1
    Junior Member
    Join Date
    May 2007
    Posts
    20

    resolved How to get the real width of a button?

    Example:
    PHP Code:
    var resetButton:Button = new Button();
    resetButton.label "Blabera Blub!";    
    resetButton.move
    (
       
    stage.width/2-resetButton.width/2,
       
    stage.height/2-resetButton.height/2
    );
    addChild(resetButton); 
    Button always ends up slightly to the left.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    If you want the actual width and height of the movie you need to write this:
    stage.stageWidth/2+resetButton.width/2,
    stage.stageHeight/2+resetButton.height/2

    if you actually want to center your button then this is correct:
    stage.stageWidth/2-resetButton.width/2,
    stage.stageHeight/2-resetButton.height/2
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    May 2007
    Posts
    20
    Solved already. Code was ok, the way I nested it was not...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center