#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Posts
    305
    Rep Power
    0

    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
  3. Prisoner of the Sun

    Join Date
    Jul 2004
    Location
    The Mews At Windsor Heights
    Posts
    5,309
    Rep Power
    2350
    Something like:
    actionscript Code:
     
    button1._y = (Stage.height - 20) - (button1._height/2);
    .
    :: My blip.fm tunes :: Web Design Feeds :: Web Dev Feeds :: CheatSheets :: PHP :: MySQL :: 13 Moon FB App.

    "All matter is merely energy condensed to a slow vibration. We are all one consciousness experiencing itself - subjectively. There is no such thing as death, life is only a dream. We are the imaginations of ourselves."
    - Bill Hicks


    "Truth is hidden in the subtle nature of the heart of everything, although it is invisible. One cannot see it from inside and neither from the surface. One can only live and experience it."
    - Heart Sutra
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2006
    Posts
    69
    Rep Power
    9
    Just so you know, "Stage.whatever" is often problematic if you use it within the first couple frames of the movie. The movie needs a little time to "sense" its own dimensions I guess.
  6. #4
  7. No Profile Picture
    Gotta get to the next screen..
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2003
    Location
    Legion of Dynamic Discord
    Posts
    6,675
    Rep Power
    3164
    that's why you would use the stages onResize event handler:
    Code:
    // keyframe 1 of _root
    Stage.scaleMode = "noScale";
    
    // The following can go anywhere i.e. doesn't have to be in _root
    function onResize()
       {
          button1._y = (Stage.height - 20) - (button1._height * 0.5); 
       }
    
    Stage.addListener(this);
    
    // I always just call it once at the start to ensure everything gets positioned correctly initially
    this.onResize();
    Now whenever the Stage is resized that function will get called and the buttons will be repositioned. One thing to note is that in IE the function only gets called when the browser resizing has finished i.e. once you've released the mouse. In FF it gets constantly called as the browser is resized.
    Quis custodiet ipsos custodes?

IMN logo majestic logo threadwatch logo seochat tools logo