-
stage.scale
Hi,
i'm using Stage.scaleMode = "showAll"; to automatically resize my mc.
In the mc there's a menu bar which should stay the same size.
How do i do this?
-
Prid - Outing
Not possible, with showAll, the Stage dimensions don't change when resized, and neither can you apply an onResize listener!
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
If you're aiming for a fluid layout, where everything is positioned/sized based on the size of the stage, you might need to look at Stage.scaleMode = StageScaleMode.NO_SCALE. This mode means that nothing is scaled, however, so it could mess up your work flow.
You can, however, add an event listener for when the stage's size is adjusted (unlike with the showAll scale mode, that Nig 13 pointed out) so that you can adjust the size of your content. A basic example would be:
Code:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeContent, false, 0, true);
function resizeContent(evt:Event):void{
menuBar.width = stage.stageWidth;
}
The stage.align property says that all objects are positioned from the top left, so at the very top left, x and y are 0. So placing menuBar at x = 0 will attach it to the left side of the stage, and resizing the width to equal the stage's width will simply stretch it out across the page.
Here's a good site if you want to get another example (that's better easier to understand than mine too). http://www.kirupa.com/developer/as3/...tering_as3.htm
-
Prid - Outing
Great, Danny22, but maybe he's using AS2 since he mentioned this: Stage.scaleMode = "showAll";
It's a bit different in AS2, but the concept is the same:
Actionscript Code:
Stage.scaleMode = "noScale"; Stage.align = "TL";
resizeListener = new Object(); resizeListener.onResize = function(){ // example code, this will align // a movieclip to the center of your Flash mc._x = Stage.width/2; mc._y = Stage.height/2; } Stage.addListener(resizeListener);
There was a good tutorial in AS2 for this as well, but it was deleted recently
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Originally Posted by Nig 13
Great, Danny22, but maybe he's using AS2 since he mentioned this: Stage.scaleMode = "showAll";
It's a bit different in AS2, but the concept is the same:
Actionscript Code:
Stage.scaleMode = "noScale"; Stage.align = "TL";
resizeListener = new Object(); resizeListener.onResize = function(){ // example code, this will align // a movieclip to the center of your Flash mc._x = Stage.width/2; mc._y = Stage.height/2; } Stage.addListener(resizeListener);
There was a good tutorial in AS2 for this as well, but it was deleted recently
Yikes, good point. I only ever did a tiny bit of AS2 and for some reason thought that either the string of the StageScaleMode property was the same. Also, I need to tab out my code better, heh.
-
Prid - Outing
lol, but you know AS3, which is way more popular nowadays, so that's good
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|