Revision: 14981
Updated Code
at June 20, 2009 14:15 by trevorhartman
Updated Code
// STEP 1
// Create _contentWidth and _contentHeight as private vars to store the initial _content dimensions.
_contentWidth = _content.width;
_contentHeight = _content.height;
// STEP 2
// In your resize handler, use the following code:
var scale:Number = 1;
if ( _contentWidth < stage.stageWidth || _contentHeight < stage.stageHeight )
{
scale = Math.max( stage.stageHeight / _contentHeight, stage.stageWidth / _contentWidth );
}
// STEP 3
// To apply the calculated scale, use:
_content.width = _contentWidth * scale;
_content.height = _contentHeight * scale;
Revision: 14980
Updated Code
at June 19, 2009 00:47 by trevorhartman
Updated Code
// STEP 1
// Create _contentWidth and _contentHeight as private vars to store the initial _content dimensions.
_contentWidth = _content.width;
_contentHeight = _content.height;
// STEP 2
// In your resize handler, use the following code:
var scale:Number = 1;
if ( _contentWidth < stage.stageWidth || _contentHeight > stage.stageHeight )
{
scale = Math.max( stage.stageHeight / _contentHeight, stage.stageWidth / _contentWidth );
}
// STEP 3
// To apply the calculated scale, use:
_content.width = _contentWidth * scale;
_content.height = _contentHeight * scale;
Revision: 14979
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 19, 2009 00:46 by trevorhartman
Initial Code
// STEP 1
// Create _contentWidth and _contentHeight as private vars to store the initial _content dimensions.
_contentWidth = _content.width;
_contentHeight = _content.height;
// STEP 2
// In your resize handler, use the following code:
var scale:Number = 1;
if ( _contentWidth < stage.stageWidth || _contentHeight > stage.stageHeight )
{
scale = Math.max( stage.stageHeight / _contentHeight, stage.stageWidth / _contentWidth );
}
// STEP 3
// To apply the calculated scale, use:
_content.width = _contentWidth * scale;
_content.height = _contentHeight * scale;
Initial URL
Initial Description
Initial Title
smart background scaling
Initial Tags
resize, background
Initial Language
ActionScript 3