Re: [flexcoders] Centering my app on the screen...

2009-05-16 Thread Laurence MacNeill
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
>www.igorcosta.org
>
>Â
>On Sat, May 16, 2009 at 8:13 PM, Laurence 
>MacNeill <lmacne...@comcast.net> 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
>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



Re: [flexcoders] Centering my app on the screen...

2009-05-16 Thread Igor Costa
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
www.igorcosta.org


On Sat, May 16, 2009 at 8:13 PM, Laurence MacNeill 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
www.igorcosta.com
www.igorcosta.org


[flexcoders] Centering my app on the screen...

2009-05-16 Thread Laurence MacNeill
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