Copy link to clipboard
Copied
Hi,
I've created a Flash website. However, when I resize the published SWF (or the preview window within Flash) some of the elements get displaced. How can I create a "wrapper" like in Dreamweaver so that the window can be dragged out to any size and all of the components stay together as they were intended?
Here is what I mean:
http://i1124.photobucket.com/albums/l567/niksavtchenko/2.jpg
http://i1124.photobucket.com/albums/l567/niksavtchenko/1.jpg
Thanks,
Nik
Copy link to clipboard
Copied
you can specify your layout in an onResize listener:
var stageListener:Object={};
stageListener.onResize=function(){
// position header
// position content
// etc
}
Stage.addListener(stageListener);
Copy link to clipboard
Copied
thank you so much! can you give me an example of what I would enter for position header, content, etc? My document size is 1024 x 768. sorry, I'm new to flash.
Copy link to clipboard
Copied
your exact code depends on what you want. but, for example, if you wanted your header to be centered horizontally and your content to be centered horizontally and vertically, you could use:
var stageListener:Object={};
stageListener.onResize=function(){
// position header
header._x = (Stage.width-header._width)/2;
// position content
content._x = (Stage.width-content._width)/2;
content._y = (Stage.height-content._height)/2;
}
Stage.addListener(stageListener);
// and you will probably want to check the stage scaleMode properties.
Copy link to clipboard
Copied
for some reason when I copy and paste this code my swf gets stuck loading and blinks uncontrollably. what should I do? also, how do I check the stage scaleMode properties? I'm so sorry I don't know Flash well at all!
Copy link to clipboard
Copied
what error message do you see?
check the flash help files, the Stage class.
Copy link to clipboard
Copied
How would I do that? I tried using this code:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onResize);
function onResize(e:Event=null):void
{
trace( stage.stageWidth );
}
Copy link to clipboard
Copied
are you publishing for as3 or as2?
Copy link to clipboard
Copied
as3, flash player 9
Copy link to clipboard
Copied
you're posting in the wrong forum. the previously suggested code was for as2.
for as3, your code will work.
Copy link to clipboard
Copied
nothing happens when I use my code. I pasted it at the end of the main AS. what am I doing wrong?
Copy link to clipboard
Copied
what do you expect to happen? you only have a trace() statement in your listener function and it's not clear you know how to find trace output when you open that html file in your browser
Copy link to clipboard
Copied
nope. my website is 1024px x 768px
Copy link to clipboard
Copied
?