A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Only hard-coded numbers are working

  1. #1
    Senior Member ::bluemoth::'s Avatar
    Join Date
    Jun 2001
    Posts
    521

    Only hard-coded numbers are working

    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;

  2. #2
    Senior Member ::bluemoth::'s Avatar
    Join Date
    Jun 2001
    Posts
    521
    Nevermind. I decided to try the dynamic values outside the conditional block, and voila. They work. Not sure why the conditional block fails silently, but that isn't important right now. Thanks anyway to anybody reading this.

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