In the line that says 
'centerMyContainer(yourComp)'  what did you mean 
by 'yourComp'?  My container?  What container contains the whole app?

And I assume I just call 'centerMyContainer' when 
the app first starts up, right?  To make it 
centered in the browser from the very beginning, yes?

Thanks,
L.


At 10:57 PM 5/16/2009, you wrote:


>Laurence, yes.
>Â
>Â
>Just create a utility function like and for 
>center the container each time the browser 
>resize, you just add a eventlistener to the stage of app like.
>Â
>Â
>import flash.display.DisplayObject;
>import mx.events.ResizeEvent;
>
>public static function centerMyContainer(target:DisplayObject):void {
>Â Â Â Â target.x =Â  this.width/2 - target.width * 0.5;
>Â Â Â Â target.y = this.height / 2 - target.height * 0.5;
>Â Â Â Â
>Â Â }
>Â Â private function init():void {
>Â Â Â addEventListener(ResizeEvent.RESIZE, centerit);
>Â Â Â // called in property like creationComplete on mx:Application tag
>Â Â }
>Â Â private function centerIt(e:ResizeEvent):void {
>Â Â Â centerMyContainer(yourComp);
>Â Â }
>Â
>}
>Â
>Regards
>Igor
><http://www.igorcosta.org/>www.igorcosta.org
>
>Â
>On Sat, May 16, 2009 at 8:13 PM, Laurence 
>MacNeill <<mailto:[email protected]>[email protected]> wrote:
>
>
>Is there a way I can center my app in the browser window? And keep
>it there if/when the browser is re-sized?
>
>Thanks,
>
>Laurence MacNeill
>Mableton, Georgia, USA
>
>
>
>
>--
>----------------------------
>Igor Costa
><http://www.igorcosta.com>www.igorcosta.com
>www.igorcosta.org
>
>
>No virus found in this incoming message.
>Checked by AVG - www.avg.com
>Version: 8.5.329 / Virus Database: 
>270.12.32/2118 - Release Date: 05/16/09 17:05:00

Reply via email to