Solved

Flexible sized Flash movie - with minimum dimensions

Posted on 2009-05-13
1
247 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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…
The goal of the tutorial is to teach the user how to how to record live broadcast.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now