Hi Friends,
The following error is occurred in my component smartlogin.mxml
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at components.login::smartLogin/loginProcess()[D:\Manikandan-Flex
\cityrestro\CityRestoVer3.0\src\components\login\smartLogin.mxml:45]
at components.login::smartLogin/__login_click()[D:\Manikandan-Flex
\cityrestro\CityRestoVer3.0\src\components\login\smartLogin.mxml:86]
the main Application Code IS
[Bindable]
public var crs:com.insoft.cityresto.CityResto;
[Bindable]
public var gateway:com.insoft.cityresto.RemotingConnection;
public function init():void {
crs = new CityResto();
gateway =
crs.establishConnection(ServerPath.toString(),crossdomainroot.toString());
}
in SmartLogin.mxml code is
-----------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
<![CDATA[
import mx.core.Application;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]
private var status:ArrayCollection;
/* public function init():void {
pass.width=0;
loginbutton.width=0;
} */
private function
usernameKeyPress(eve:KeyboardEvent):void {
if (eve.keyCode==32){
eve.keyCode=0;
}
else if (eve.keyCode==13) {
if (username.length!=0)
password.setFocus();
else
Alert.show ("Username Field Not
Empty","City Resto Alert");
}
}
private function
passwordKeyPress(eve:KeyboardEvent):void {
if (eve.keyCode==32){
eve.keyCode=0;
}
else if (eve.keyCode==13) {
if (password.length!=0)
login.setFocus();
else
Alert.show ("Password Field Not
Empty","City Resto Alert");
}
}
private function loginProcess():void {
var user=username.text;
var pass=password.text;
fade.play();
Application.application.gateway.call("Login.checkLogin", new
Responder(function(result:Array): void {
status = new ArrayCollection(result);
}, onFault),user,pass);
if (status.length!=0) {
checkpoint.height=0;
welcome.height=100;
}
else {
checkpoint.height=0;
errorfade.play();
error.height=100;
}
}
private function clearArea():void {
username.text="";
password.text="";
status.removeAll();
status.refresh();
}
private function signOut():void {
clearArea();
welcome.height=0;
checkpoint.height=100;
}
private function errorLogin():void {
clearArea()
error.height=0;
checkpoint.height=100;
}
private function onFault( fault : String ) : void {
Alert.show("Fault Occur Smart Login"+
fault.toString() );
}
]]>
</mx:Script>
<mx:WipeUp id="fade" duration="1000" target="{checkpoint}"/>
<mx:WipeUp id="errorfade" duration="1000" target="{error}"/>
<mx:HBox width="500" horizontalAlign="right" resizeEffect="fade"
id="checkpoint">
<mx:Label text="User Name" color="#FFFFFF" alpha="0.46"/>
<mx:TextInput id="username" displayAsPassword="false"
editable="true" enabled="true" maxChars="10"
keyDown="usernameKeyPress(event);" alpha="0.46" color="#FFFFFF"
fontSize="13"/>
<mx:Label text="Password" color="#FFFFFF" alpha="0.46"/>
<mx:TextInput id="password" displayAsPassword="true"
editable="true"
enabled="true" maxChars="10" keyDown="passwordKeyPress(event);"
alpha="0.46" color="#FFFFFF" fontSize="13"/>
<mx:Button enabled="true" id="login" click="loginProcess()"
label="Login"/>
</mx:HBox>
<mx:HBox width="500" horizontalAlign="right" resizeEffect="fade"
id="welcome" height="0">
<mx:Label text="Welcome [ {username.text} ]"
color="#FFFFFF"/
><mx:Label text="Sign Out" color="#FFFFFF" click="signOut()" />
</mx:HBox>
<mx:HBox width="500" horizontalAlign="right" resizeEffect="fade"
id="error" height="0">
<mx:Label text="Invalid User Try | Re-Login Again"
click="errorLogin();" color="#FFFFFF"/>
</mx:HBox>
</mx:VBox>
How to shortout this bug.
Help Me My Friends.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---