Hi geetha,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF,
#FFFFFF]" alpha="1.0">
<mx:Script>
   <![CDATA[
   import mx.controls.Alert;
       public function login():void
       {
         if(textinput2.text=="MLRIT" && t2.text=="MLRIT")
         {
         currentState='Register';
         }
else
{
        Alert.show("UserName and password do not match");
}
}
   ]]>
</mx:Script>
   <mx:states>
       <mx:State name="Register">
           <mx:AddChild relativeTo="{t2}" position="lastChild">
               <mx:Label x="31" y="84" text="Email id"/>
           </mx:AddChild>
           <mx:AddChild relativeTo="{t2}" position="lastChild">
               <mx:TextInput x="81" y="82" width="149"/>
           </mx:AddChild>
           <mx:SetProperty target="{t2}" name="title"
value="Registration"/>
           <mx:RemoveChild target="{linkbutton1}"/>
           <mx:AddChild relativeTo="{t2}" position="lastChild">
               <mx:LinkButton x="22" y="130" label="Home"
click="currentState='Home'"/>
           </mx:AddChild>
       </mx:State>
       <mx:State name="Home">
           <mx:SetProperty target="{t2}" name="title" value="Home"/>
           <mx:RemoveChild target="{label1}"/>
           <mx:RemoveChild target="{label2}"/>
           <mx:RemoveChild target="{textinput2}"/>
           <mx:RemoveChild target="{linkbutton1}"/>
           <mx:SetProperty target="{t2}" name="width" value="404"/>
           <mx:SetProperty target="{t2}" name="height" value="276"/>
           <mx:AddChild relativeTo="{t2}" position="lastChild">
               <mx:Image x="0" y="0" width="166" height="122"
source="img/Water lilies.jpg"/>
           </mx:AddChild>
           <mx:RemoveChild target="{button1}"/>
           <mx:AddChild relativeTo="{t2}" position="lastChild">
               <mx:Button x="182" y="158" label="Logout"
click="currentState=''"/>
           </mx:AddChild>
       </mx:State>
   </mx:states>
   <mx:Panel x="69" y="55" width="343" height="212" layout="absolute"
title="Login" >
       <mx:Label x="10" y="22" text="Username" id="label1"/>
       <mx:Label x="10" y="58" text="password" id="label2"/>
       <mx:TextInput x="80" y="20" width="150" id="textinput2"/>
       <mx:Button x="215" y="130" label="Login" id="button1"/>
       <mx:LinkButton x="42" y="130" label="Register"
id="linkbutton1" click="'login()'"/>
       <mx:TextInput x="74" y="56" id="t2"/>
   </mx:Panel>

</mx:Application>



Your code without the errors.

On Fri, Oct 9, 2009 at 10:39 PM, geetha <[email protected]> wrote:

>
> Hi, everyone
> here is my code for login of username and password.
> its showing an error in the script part of the code.can u help  me in
> making it an error free code.
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:Script>
>    <![CDATA[
>        public function login()
>        {
>         if(textinput2.text=="MLRIT" && t2.text=="MLRIT")
>          currentState='Register';
>
>        else
>         Alert.show(event.fault.tostring());
>
> }
>    ]]>
> </mx:Script>
>    <mx:states>
>        <mx:State name="Register">
>            <mx:AddChild relativeTo="{t2}" position="lastChild">
>                <mx:Label x="31" y="84" text="Email id"/>
>            </mx:AddChild>
>            <mx:AddChild relativeTo="{t2}" position="lastChild">
>                <mx:TextInput x="81" y="82" width="149"/>
>            </mx:AddChild>
>            <mx:SetProperty target="{t2}" name="title"
> value="Registration"/>
>            <mx:RemoveChild target="{linkbutton1}"/>
>            <mx:AddChild relativeTo="{t2}" position="lastChild">
>                <mx:LinkButton x="22" y="130" label="Home"
> click="currentState='Home'"/>
>            </mx:AddChild>
>        </mx:State>
>        <mx:State name="Home">
>            <mx:SetProperty target="{t2}" name="title" value="Home"/>
>            <mx:RemoveChild target="{label1}"/>
>            <mx:RemoveChild target="{label2}"/>
>            <mx:RemoveChild target="{textinput2}"/>
>            <mx:RemoveChild target="{linkbutton1}"/>
>            <mx:SetProperty target="{t2}" name="width" value="404"/>
>            <mx:SetProperty target="{t2}" name="height" value="276"/>
>            <mx:AddChild relativeTo="{t2}" position="lastChild">
>                <mx:Image x="0" y="0" width="166" height="122"
> source="img/Water lilies.jpg"/>
>            </mx:AddChild>
>            <mx:RemoveChild target="{button1}"/>
>            <mx:AddChild relativeTo="{t2}" position="lastChild">
>                <mx:Button x="182" y="158" label="Logout"
> click="currentState=''"/>
>            </mx:AddChild>
>        </mx:State>
>    </mx:states>
>    <mx:Panel x="69" y="55" width="343" height="212" layout="absolute"
> title="Login" id="t2">
>        <mx:Label x="10" y="22" text="Username" id="label1"/>
>        <mx:Label x="10" y="58" text="password" id="label2"/>
>        <mx:TextInput x="80" y="20" width="150" id="textinput2"/>
>        <mx:Button x="215" y="130" label="Login" id="button1"/>
>        <mx:LinkButton x="42" y="130" label="Register"
> id="linkbutton1" click="'login()'"/>
>        <mx:TextInput x="74" y="56"/>
>    </mx:Panel>
>
> </mx:Application>
>
> Thank you in Advance.
>                                     -GEETHA
>
> >
>


-- 
Regards,
Ganaraj P R

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to