Not so fast Doug!  Here is a full example:

Tracy

 

<?xml version="1.0" encoding="utf-8"?>

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

    xmlns="*"

    layout="vertical" 

    creationComplete="initApp()">

      

<mx:Script><![CDATA[

  //import mx.rpc.events.ResultEvent;

            import mx.containers.TitleWindow;

            import mx.managers.PopUpManager;

 

  [Bindable]private var _xmlLoginStatus:XML;

  private var _twLogin:TWLogin;

 

  /** Runs on creationComplete */

            private function initApp():void

            {

                        _twLogin =
TWLogin(PopUpManager.createPopUp(this, 

 
TWLogin, 

 
true));                //instantiate and show the title window

    _twLogin.mainApp = this;                              //pass
reference to main app to title window

                        PopUpManager.centerPopUp(_twLogin);

            

            }//initApp

            

            /** called by Titlewindow login */

            public function authenticateUser(sUser:String,
sPwd:String):void

            {

    var sStatusSim:String = (sPwd.length>0) ? "authenticated" :
"invalid";

    var sXML:String = '<loginresult status="' + sStatusSim + '" />';

    var xmlResultSim:XML = new XML(sXML);

    onResult({result:xmlResultSim});    //in actual app would call a
dataservice to authenticate user

            }           

            

            /** simulated result handler  */

            private function onResult(oEvent:Object):void

            {

              _xmlLoginStatus = XML(oEvent.result);              //gets
the XML of Aauthentication status

              if ([EMAIL PROTECTED] == "authenticated") {

                PopUpManager.removePopUp(_twLogin);

              }

              else  {

                _twLogin.loginStatus = "Log-In failed"

              

              }

            }//onResult  

]]></mx:Script>

 

  <mx:Label text="Hello World!" fontSize="24" />     

</mx:Application>

 

 

<?xml version="1.0" encoding="utf-8"?>

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"

                        creationComplete="initComponent()"

                        showCloseButton="false"

                        close="closeWindow()">

<mx:Script><![CDATA[

  import mx.managers.PopUpManager;

  import mx.collections.ArrayCollection;

  

            [Bindable]public var mainApp:TWLoginApp = null; 

            [Bindable]public var loginStatus:String = "";          

            

            private function initComponent():void

            {

 

            }

            

            private function checkLogin():void

            {

    mainApp.authenticateUser(tiUser.text,tiPwd.text)

            }           

            

            private function closeWindow():void

            {

              PopUpManager.removePopUp(this);

            }//closeWindow

            

 

]]></mx:Script>

            

            <mx:HBox >

                        <mx:Label id="lblUser" text="User:"
width="100"/>

                        <mx:TextInput id="tiUser" text=""  width="100"/>

            </mx:HBox>

            <mx:HBox >

                        <mx:Label text="Password:"  width="100"/>

                        <mx:TextInput id="tiPwd" text="" width="100"  />

                        <mx:Label text="(any string is valid)"
fontStyle="italic" width="150"/>

            </mx:HBox>                  

            <mx:HBox >

                        <mx:Button label="Login" click="checkLogin()"/>

                        <mx:Button label="Cancel"
click="closeWindow()"/>

            </mx:HBox>      

            <mx:Label id="lblStatus" text="{loginStatus}" fontSize="18"
color="red"     />

</mx:TitleWindow>

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Doug McCune
Sent: Wednesday, January 17, 2007 4:12 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: title window on app first run

 

Wow, such intensity for this post. 

You've got a click event specified for that button that you have on
stage that says "Login or Register". That click event calls some
function that calls PopupManager.createPopup, which creates a modal
popup. All you need to change is to use the creationComplete event of
the Application, as opposed to the click event of the Button.

So you've got something like <mx:Button label="Login or Register"
click="launchPopup(event)" />

and just take out the click event and make the application tag look
something like <mx:Application creationComplete="launchPopup(event)" />

Cool? Easiest $100 ever made.


jonalexander370 wrote: 

        Hi Jeff,
        
        Thank you for your reply.
        
        What sample code in the Flex docs?
        
        I am studying via www.lynda.com.
        
        If you could provide a URL to the Flex docs sample code, this
would
        most greatly appreciated.
        
        Jon Alexander
        [EMAIL PROTECTED] <mailto:sales%40e-revenues.com> 
        
        --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Battershall, Jeff"
        <[EMAIL PROTECTED]> wrote:
        >
        > Don't have time to write the code for you - but I will give
you the
        > following hints:
        > 
        > 1) Your TitleWindow would be a separate MXML component, i.e.,
        > LoginWindow.mxml.
        > 2) Your app has a 'creationComplete' event which should fire a
private
        > function to popup your TitleWindow. You can build off the
sample code
        > in the Flex docs. 
        > 
        > Maybe someone else can help more...
        > 
        > Jeff
        > 
        > -----Original Message-----
        > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
        > Behalf Of jonalexander370
        > Sent: Wednesday, January 17, 2007 3:28 PM
        > To: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
        > Subject: [flexcoders] Re: title window on app first run
        > 
        > 
        > Hello, as I am having great difficulty completing this task,
CAN ANYONE
        > STEP IN and help, please, I am offering a cash payment of $100
for
        > anyone to complete the initial coding with extensive
commenting of the
        > code so I can learn from it, please.
        > 
        > Jon Alexander
        > [EMAIL PROTECTED]
        > 
        > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "jonalexander370"
        > <jonalexander370@> wrote:
        > >
        > > Hello,
        > > 
        > > Am very new to Flex am trying to have the first web page
view being a 
        > > primary login / registration TitleWindow with the main
application as 
        > > a fuzzy background.
        > > 
        > > 1. Upon arrival at our web page at http://www.e-revenues.com
<http://www.e-revenues.com>  the
        > > first view would be a login / register page with an
advertising Flash 
        > > intro similar to Raymond Camden's Lemonade Stand Game at:
        > >
        >
http://ray.camdenfamily.com/index.cfm/2006/11/21/My-Thanksgiving-Flex-Ho
<http://ray.camdenfamily.com/index.cfm/2006/11/21/My-Thanksgiving-Flex-H
o> 
        > mework
        > > and actual application at:
        > http://ray.camdenfamily.com/demos/ls/main.html
<http://ray.camdenfamily.com/demos/ls/main.html> 
        > > 
        > > 2. EXCEPT, I wish to have the main application background
fuzzy'ed
        > > out, if you click the START GAME button you shall see the
effect with 
        > > the Instructions being forefront and the main application
being 
        > > fuzzy'ed out in the background.
        > > 
        > > 3. To clarify, the main app would be in the background
fuzzy'ed out
        > > with the login / registration being a TitleWindow in the
foreground.
        > > 
        > > Any and all suggestions would be greatly appreciated.
        > > 
        > > Thank you.
        > > 
        > > Jon Alexander
        > >
        > 
        > 
        > 
        > 
        > --
        > Flexcoders Mailing List
        > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
        > Search Archives:
        > http://www.mail-archive.com/flexcoders%40yahoogroups.com
<http://www.mail-archive.com/flexcoders%40yahoogroups.com>  
        > Yahoo! Groups Links
        >

 

 

Reply via email to