Solved

Flexible sized Flash movie - with minimum dimensions

Posted on 2009-05-13
1
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

691 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