Results 1 to 3 of 3

Thread: Positioning Buttons Always At The Bottom Of Stage

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Positioning Buttons Always At The Bottom Of Stage

    I have a group of 6 buttons which on my stage sit in the center and are 20 pixels from the bottom, I am trying to create a bit of a liquid layout, and the browser is going to be able to resized by the user. I want always for the buttons to stay at the bottom in the center of the browser 20 pixels from the bottom no matter wether it is resized too... any ideas?

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Use math to get width and height. Make proportional to stage (would go into more detail but I have seen your codes and you have done this before )

    Place on the stage with AS instead of manual placement, and set the _.x and _.y to be the same proportions as well, where they will sit 20 pixels from the bottom.

    (don't forget to "export for actionscript )
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2007
    Location
    Charlotte, NC
    Posts
    82
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    First I would create a "menu" mc (make sure to give it an instance name of menu) with the 6 buttons inside. Make sure you align all the buttons above the y-axis (y will be a negative number) and in the middle of the x-axis otherwise the values below wouldn't quite work.
    Code:
    Stage.scaleMode = "noScale";
    Stage.align = "tl";
    
    stageListener = new Object();
    
    function setMenu() {
            menu._y = Stage.height-20;
    	menu._x = Stage.width/2;
    }
    stageListener.onResize = function () {
    	setMenu();
    }
    Stage.addListener(stageListener);
    
    setMenu();
    Last edited by jamiller; 04-21-2007 at 12:03 AM. Reason: forgot to add some important code

Bookmarks

Posting Permissions

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