3 Replies Latest reply on Nov 2, 2010 3:18 AM by selvakumar p

    Flex application to display in the center

    kminKeller Level 1

      I have an application where I use viewStack with a login box and the main app. Code is as below.

      <Application

           xmlns:mx="http://www.adobe.com/2006/mxml"

           layout="absolute">

       

                <mx:Script>

                     private function handleAuthenticateSuccess(e:Event): void {

                          vsViews.selectedChild = applicationView;

                     }

       

                     private function handleAuthenticateFailure(e:Event): void {

                          vsViews.selectedChild = loginView;

                     }

                </mx:Script>

      <mx:VBox width="70%" height="70%" verticalScrollPolicy="off" horizontalScrollPolicy="off"

           horizontalAlign="center" verticalAlign="middle">

       

           <mx:ViewStack id="vsViews" width="100%" height="100%" paddingTop="0"

                creationPolicy="all">

                <mx:VBox id="loginView" horizontalCenter="0" verticalCenter="0" width="100%" height="100%">

                          <mx:Canvas width="100%" height="100%">

                               <views:LoginView width="100%" height="100%" />

                          </mx:Canvas>

                        </mx:VBox>

                        <mx:VBox id="applicationView" width="100%" height="100%" backgroundAlpha="0"

                               verticalScrollPolicy="off" horizontalScrollPolicy="off" paddingTop="0" borderStyle="solid" borderThickness="2"

                              verticalCenter="0" horizontalCenter="0" showEffect="Fade" hideEffect="Fade">

                               <views:Header width="100%" />

                              <mx:VBox width="100%" height="100%" paddingTop="0" paddingBottom="0">

                                  <views:MainView  id="mainView" width="100%" height="100%"  horizontalCenter="0" verticalCenter="0"/>

                              </mx:VBox>

                              <views:ControlBar  id="control" width="100%" height="22" />

                             <views:Footer width="100%" />

                     </mx:VBox>

      </mx:ViewStack>

      </mx:VBox>

      </Application>

       

      Note that I am using only 70% of the browser as I do not need to use 100% of the browser. I am not been able to display the my app in the center.

       

      Please let me know if you need more info. Any help would be appreciated.

       

      Thanks.

       

      KM