Hi Tracy you asked hw far i was, well i decided to redo it from
scratch so that i can get guidance. now i have 4 mxml files. one is
the main application(login_example.mxml) and there is the Home.mxml
which is the default view, the Admin.mxml which requires one to login
in order to view it and a login.mxml which is the popup login form.
now from there all a ask 4 is a simple cfc that will do the
authentication and also how to use it in my flex app. here is my code.

"login_example.mxml"
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" xmlns:view="components.*">
        <mx:states>
                <mx:State name="Log Out">
                        <mx:SetProperty target="{label1}" name="text" 
value="Log Out"/>
                </mx:State>
        </mx:states>
        <mx:Script>
                <![CDATA[
                        import components.*;
                        import flash.events.MouseEvent;
                        import mx.managers.PopUpManager;
                        import mx.core.IFlexDisplayObject;
                        private var myLoginForm:IFlexDisplayObject;
                        private function showPopUp(e:MouseEvent):void {
                        myLoginForm = PopUpManager.createPopUp(this, Login, 
true);
                }
                ]]>
        </mx:Script>
        <mx:Label x="0" y="0" text="Sign In" id="label1" buttonMode="true"
useHandCursor="true" mouseChildren="false" click="showPopUp(event)"/>
        <mx:ViewStack x="0" y="26" id="viewstack1" width="100%" height="100%">
                <view:Home id="home"/>
        </mx:ViewStack> 
</mx:Application>

"Home.mxml"

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
height="100%" backgroundColor="#ff8000">
        
</mx:Canvas>

"Admin.mxml"

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
height="100%" backgroundColor="#400000">
        
</mx:Canvas>

"login.mxml"

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" title="Login Form"
creationComplete="PopUpManager.centerPopUp(this)">
        <mx:Script>
                <![CDATA[
                        import mx.managers.PopUpManager;
                ]]>
        </mx:Script>
        <mx:Form x="0" y="0">
                <mx:FormItem label="User Name:">
                        <mx:TextInput/>
                </mx:FormItem>
                <mx:FormItem label="Password:">
                        <mx:TextInput/>
                </mx:FormItem>
        </mx:Form>
        <mx:ControlBar>
                <mx:Button label="Login"/>
        </mx:ControlBar>
        
</mx:TitleWindow>

please guys this would mean alot to me. thanks for sticking up to this
point.

Reply via email to