wood burning stoves 2.0*
The moose likes Flex and the fly likes Aligning a Login Page at the center Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Flex
Bookmark "Aligning a Login Page at the center" Watch "Aligning a Login Page at the center" New topic
Author

Aligning a Login Page at the center

nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

Hi,

I have a very basic question on flex. I'm facing problem in aligning a login page at the center of the page.




I want the component at the center of the screen.

Thanks
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
this will be a hard question unless you give more information about you layout, are you displaying this login as a popup, or just embed it to your application page. what's your layout options(absolute, vertical, horizontal, constrained layout...etc)


Do you know why this cup is useful? Because it is empty.
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

Hi,

Thanks for your reply.

Sorry for incomplete details. Yes its embed in the mxml page. The whole login.mxml page is embed in main index.mxml something like this....





login.mxml is a HBox (Code which I have posted in the first post is login.mxml code).

Also, layout which I have used is absolute. Which layout will help me in doing this?

Thanks in advance

Cheers
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
try change verticalAlign=center and horizontalAlign = center to verticalCenter="0" horizontalCenter="0"
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

Hi Hongli,


Login screen is at the top left corner now not at the center of the page.


This is what I have done..


Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
you should specify verticalCenter="0" horizontalCenter="0" at parent page the application page
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

No luck


my parent page (index.mxml) now looks like this (still login box comes at left topmost corner)

nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

Please see the screenshot..How its currently displaying.

Pink box is where I want the login box to appear

Hope this makes more sense


Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
what about removing horizontalCenter="0" verticalCenter="0" in your Application tag, you don't need them there. and further more you can modularize you component, make a login component then import it in your main page, so that you can reuse the loing component everywhere you want to use it.
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

sorry its not coming in the center (at pink rectangular box)

yes thats right. No need of that attibute in mx:Application tag
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
<!-- start login module include-->
<mx:HBox horizontalAlign="center"> will centerize your login page.
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

<mx:HBox horizontalAlign="center"> is just moving the login control from topmost left to topmost middle. Still its NOT at the pink box.
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

I have got it now




horizontalAlign center move the login control from topmost left to topmost middle and verticalAlign will move it from topmost middle to center of the page (i.e., at the pink box)


Happy ending
Hongli Li
Ranch Hand

Joined: Oct 29, 2006
Posts: 124
nice you got it, but if use flex builder or plugin for eclipse, you should be able to modify the container properties via Property panel, it's a WYSIWYG editor.
nazzy khan
Ranch Hand

Joined: May 06, 2010
Posts: 39

Yeah thats right. Editplus little frustrating
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Aligning a Login Page at the center