PDA

View Full Version : Aligning individual movie clips in a flash document


cmxsevenfoldxmc
06-15-2008, 06:22 AM
Hi everyone,

I've been trying to figure out a way to keep different movie clips in their own positions in the same flash document.

For example: I want a mini nav bar to be on the bottom right permanently, and have the logo of the company appear in the center.

Here's the code I have so far, which sets the whole document to the bottom right:


Stage.scaleMode = "noScale";
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
df_main = Stage.align = "C";
df_bottom = Stage.align = "BR";
}
positionContent();


Any ideas?

Thank you all very much in advance.

gnomeontherun
06-15-2008, 09:05 PM
I've always used math to find it like so:

Stage.scaleMode = "noScale";
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
var windowSize = Stage.width;
df_main._x = windowSize / 2; // Should center it
df_bottom._x = windowSize - df_bottom._width; // Should right align it
}
positionContent();

cmxsevenfoldxmc
06-16-2008, 05:58 AM
Hey jeremy,

Thanks for your help. The center piece was successfully centered, but the bottom piece just ended up going too far off the right.

I'm trying to work with the math there but my logic isn't being my best friend right now lol.

Any ideas?

Thanks.

gnomeontherun
06-16-2008, 08:27 PM
Subtract a number to make it move left.

cmxsevenfoldxmc
06-17-2008, 07:38 AM
Jeremy,

Unfortunately, whatever number I input into it, depending on the size of the window, it will either fall too far to the right or too far in.

Is there an alternative other than math to do this?

The center piece still works though.

gnomeontherun
06-17-2008, 06:13 PM
There are other ways, but this is the easiest. You can calculate it by taking the width of your stage, and subtracting the width of your movieClip. So its the easiest way I know, so why not just change the number until its where you want? Maybe I'm not able to understand what you are actually trying to do so do you have the file to view?

cmxsevenfoldxmc
06-18-2008, 05:59 AM
Jeremy,

The strawhorse (very very rough draft) of the project is still offline. I have a picture with the layout of the project, which I hope is enough to show somewhat of the layout I need it to be in.

http://sevenxde.dot5hosting.com/images/layout-example.gif

I did the whole "total window size - total width of df_bottom", and it works when the browser is the exact size of the project, but when it is resized, it drags off of the window to the right.

gnomeontherun
06-18-2008, 06:33 AM
That is peculiar then, I wonder if the stage size is being incorrectly calculated by Flash.

Maybe try adding at the top after Stage.scale="noscale";

Stage.align = "C";

Otherwise I found this, I don't know if there is anything here that might enlighten you on the situation.

http://www.tutorio.com/tutorial/liquid-flash-layout

cmxsevenfoldxmc
06-19-2008, 08:06 AM
There was some funky stuff going on with the project, and no matter what I did (even following the liquid flash layout) i still couldn't get the outcome that I needed, therefore I ended up just centering it all and adapting it accordingly.

Thanks for all your help, though. Good stuff.

Cheerio