We help IT Professionals succeed at work.
Get Started

Flex custom component  to layout in center of page...

Joel_Sisko asked
Last Modified: 2013-11-11
Dear Experts,

I am having the hardest time getting my head wrapped around the layout of a custom component inside my application. For now all I want to do is have my custom component that I am loading to be in the absolute center of the page.

So the code following loads the custom component in the main application:

In the root tag I have this:


Then within the application I call to load the component.

<MenuStates:Home includeIn="HomePage" />

The code attached is the custom component "Home"


Thanks for any insight, I have tried several settings with nothing working.

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
		 xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" currentState="HomePageMain">
		<s:State name="HomePageMain"/>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
			import com.MenuStates.*;			
	<s:SkinnableContainer includeIn="HomePageMain" width="100%" height="100%" >

		<mx:Button label="System Maintenance" width="225" height="64" icon="@Embed(source='assets/png/48x48/SystemMaintenance.png')" includeIn="HomePageMain" x="433" y="149"/>
		<mx:Button x="433" y="241" label="System Wide Features" width="225" height="64" icon="@Embed(source='assets/png/48x48/SystemWide.png')" includeIn="HomePageMain"/>
		<mx:Button x="433" y="61" label="DID's and Phone Numbers" height="64" width="225" icon="@Embed(source='assets/png/48x48/DID.png')" includeIn="HomePageMain"/>
		<mx:Button x="108" y="149" label="Users and Extensions" width="225" height="64" icon="@Embed(source='assets/png/48x48/Users.png')" includeIn="HomePageMain"/>
    	<mx:Button x="108" y="241" label="Phones and Devices" width="225" height="64" icon="@Embed(source='assets/png/48x48/Phones.png')" includeIn="HomePageMain"/>
    	<mx:Button click="currentState'CenterClients'" x="108" y="61" label="Business Center Clients" width="225" height="64" icon="@Embed(source='assets/png/48x48/Clients.png')"  includeIn="HomePageMain" />

		<mx:Image x="10" y="10" source="@Embed(source='/assets/png/32x32/help.png')" right="10" top="2" useHandCursor="true" buttonMode="true" click="OpenHelpWindow(HelpPageId);" includeIn="HomePageMain" horizontalAlign="center"/>
		<mx:Image right="10" includeIn="HomePageMain" x="10" y="42" source="@Embed(source='/assets/png/32x32/window_add.png')" useHandCursor="true" horizontalAlign="center"/>
		<mx:Image right="10" includeIn="HomePageMain" x="10" y="93" source="@Embed(source='/assets/png/32x32/previous.png')" horizontalAlign="center"/>
		<mx:Image right="10" includeIn="HomePageMain" x="10" y="138" source="@Embed(source='/assets/png/32x32/home.png')" horizontalAlign="center"/>
		<mx:Image right="10" includeIn="HomePageMain" x="10" y="181" source="@Embed(source='/assets/png/32x32/logout.png')" click="GoToState('Logout')" horizontalAlign="center"/>	


Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE