PDA

View Full Version : AS3, keeping items on the bottom of the page



daddymccoy21
March 2nd, 2010, 06:36 PM
I am looking to keep a movieClip on the bottom of the page or resize (if the screen is bigger than 760px). I can do this in AS2 no problem:



// KEEP ON BOTTOM ON RESIZE
var bottom:Object = new Object();
bottom.onResize = function () {

if (Stage.height <= 760) {
artMain._y = 130;
}

if (Stage.height > 760) {
artMain._y = Stage.height - 630;
}
}

Stage.addListener(bottom);


BUT - I am frustrated in AS3 on how to accomplish this. Help would be appreciated.

creatify
March 2nd, 2010, 07:12 PM
didn't test but:


// KEEP ON BOTTOM ON RESIZE
stage.addEventListener(Event.RESIZE, onSizeChange);
function onSizeChange(e:Event):void {
if (stage.stageHeight <= 760) {
artMain._y = 130;
} else {
artMain._y = stage.stageHeight - 630;
}
}