Detect browser edges, and to expand in the opposite direction

Hello there.

I’ve been asked to design a flash expanding banner. In the guidelines I noticed the following requirement:

Please give unit the ability to detect browser edges, and to expand in the opposite direction if expanded portion will disappear off browser window.

Of course I have no idea how to do this!
Could some kind soul possibly point me in the direction to find out how to achieve this.
I’ve searched these forums and googled, but with no luck.

Thanks.