I have been struggling to get dynamic width and height values to work. The values trace fine, but only hard-coded numbers are working. I have the variables set to Number data type and cannot think what else to do. Can somebody please slap my sleepy face and explain what I am missing. Thanks.
Code:
var deviceWidth:Number = stage.fullScreenWidth;
var deviceHeight:Number = stage.fullScreenHeight;
var pageWidth:Number = (stage.fullScreenWidth / 2);
var pageHeight:Number = (stage.fullScreenHeight / 2);
trace('thispage: ' + thispage);
trace('deviceWidth: ' + deviceWidth);
trace('deviceHeight: ' + deviceHeight);
trace('pageWidth: ' + pageWidth);
trace('pageHeight: ' + pageHeight);
//var thispage = '';
//thispage = vars.currentPage;
if (vars.currentOrientation == 'portrait') {
// Portrait
if (deviceWidth > deviceHeight) {
vars.pages[thispage].bg.width = pageWidth;
vars.pages[thispage].bg.height = pageHeight;
} else {
vars.pages[thispage].bg.height = pageWidth;
vars.pages[thispage].bg.width = pageHeight;
}
} else {
// Landscape
if (deviceWidth > deviceHeight) {
vars.pages[thispage].bg.width = pageWidth;
vars.pages[thispage].bg.height = pageHeight;
} else {
vars.pages[thispage].bg.height = pageWidth;
vars.pages[thispage].bg.width = pageHeight;
}
}
//vars.pages[thispage].bg.height = 500;
//vars.pages[thispage].bg.width = 500;