Simple geometry problem

hey all,

working on a flash site - if i cant get my head around this, the entire project is basically useless.

i need to figure out how to do the following so i can apply it to the flash site.

I need a square box to always be half of the stage width or stage height.

E.g., if stage width is 1400, the box would be 700px wide. BUT - at the same time, if the box then extends over the height of the stage (box would be 700px wide, and if stage is 500px high), i want the box to be half of the stage’s width.

So basically, the box will always be half of the stage width, or half of the stage height (whichever is smaller)

I’ve tried tons of stuff, but nothing will work. :frowning:

Thanks a bunch.