• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Flexible sized Flash movie - with minimum dimensions

I've got a stretchable flash movie with 2 key elements... a signature running 100% width anchored to the bottom of the stage, and a tag line of fixed size, anchored to the top right corner of the stage.

I've got the following code which was written to make this all work attached below.

What I want to do is somehow set a minimum size, for the flash file, so that if the browser window shrinks any further, the top right tag line won't move any further to the left. At the same point the signature won't shrink anymore and won't move any further up (so if they keep shrinking the window, these elements effectively become partially off-stage)

Ideally it would be when it reaches 670 x 670 that elements stop resizing/moving

Hope that makes sense! sorry I can't post any screenshots because it's sensitive client work.

thanks,
TM
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
 
stage.addEventListener(Event.RESIZE, resizeListener);
 
var signatureSizeRatio:Number;
signatureSizeRatio = signature.width/signature.height;
 
function resizeListener(e:Event):void {
	resizeStageElements();
}
 
function resizeStageElements()
{
	trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
	welcomeText.x = stage.stageWidth - 406;
	gradientBG.width = stage.stageWidth;
	signature.y = stage.stageHeight - 30;
	signature.width = stage.stageWidth;
	signature.height = stage.stageWidth / signatureSizeRatio;
}
 
resizeStageElements();

Open in new window

0
ARMSTRONG_CRAVEN
Asked:
ARMSTRONG_CRAVEN
1 Solution
 
wal_toorCommented:
Hellow armstrong,

What if you put an if statement in you resize function? Does this work for you?

greetz,
walter
function resizeStageElements()
{
	if(stage.stageWidth > 670 || stage.stageHeight > 670){
        trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
        welcomeText.x = stage.stageWidth - 406;
        gradientBG.width = stage.stageWidth;
        signature.y = stage.stageHeight - 30;
        signature.width = stage.stageWidth;
        signature.height = stage.stageWidth / signatureSizeRatio;
	}
}

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now