Solved

Flexible sized Flash movie - with minimum dimensions

Posted on 2009-05-13
1
250 Views
Last Modified: 2013-11-11
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
Comment
Question by:ARMSTRONG_CRAVEN
1 Comment
 
LVL 8

Accepted Solution

by:
wal_toor earned 50 total points
ID: 24385773
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Action Script commands 4 326
Failed download 57 582
deploy Adobe and Java updates to 100 workstations using LogMeIn Pro? 5 168
File conversion question 5 133
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question