gutaker
10-21-2006, 04:36 PM
hi there...
im writing a script to post a login form to php after a click and after verification php renturns something like this: <loginstate>ok</loginstate>
here is the code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function costam(): void {
loginRequest.send();
switch(loginRequest.lastResult.loginstate) {
case "ok":
Alert.show("You have been logged in...", "Login info");
break;
case "error":
Alert.show("Login failed, please try again!", "Login info");
break;
}
}
]]>
</mx:Script>
<mx:HTTPService showBusyCursor="true" id="loginRequest" method="POST" useProxy="false" url="http://venomnote/php/user_verify.php">
<mx:request xmlns="">
<uname>
{uname.text}
</uname>
<passwd>
{passwd.text}
</passwd>
</mx:request>
</mx:HTTPService>
<mx:Dissolve id="dissolveOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Dissolve id="dissolveIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
<mx:TitleWindow visible="{cblbox.selected}" showEffect="{dissolveIn}" hideEffect="{dissolveOut}" id="titwin" width="294" height="156" layout="absolute" title="Login Box" showCloseButton="false" horizontalCenter="1" verticalCenter="0" cornerRadius="0" alpha="0.5">
<mx:Form horizontalCenter="0" verticalCenter="0">
<mx:FormItem label="Username">
<mx:TextInput id="uname"/>
</mx:FormItem>
<mx:FormItem label="Password">
<mx:TextInput displayAsPassword="true" id="passwd"/>
</mx:FormItem>
<mx:Button label="Login" width="235" click="costam();" id="button1"/>
</mx:Form>
</mx:TitleWindow>
<mx:ApplicationControlBar dock="{cbdock.selected}" horizontalCenter="0" bottom="50" width="75%">
<mx:HBox width="100%" verticalAlign="middle" horizontalAlign="left">
<mx:CheckBox id="cbdock" label="Docked"/>
<mx:CheckBox id="cblbox" label="Login Box"/>
</mx:HBox>
<mx:HBox width="100%" verticalAlign="middle" horizontalAlign="right">
<mx:Label text="Control Bar"/>
</mx:HBox>
</mx:ApplicationControlBar>
</mx:Application>
what bothers me is this msg:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at test/::costam()
at test/__button1_click()
i'm total newB in as3 and flex 2, but im intermediate PHP and Delphi programmer, so please try not to yell at me :)
thx
im writing a script to post a login form to php after a click and after verification php renturns something like this: <loginstate>ok</loginstate>
here is the code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function costam(): void {
loginRequest.send();
switch(loginRequest.lastResult.loginstate) {
case "ok":
Alert.show("You have been logged in...", "Login info");
break;
case "error":
Alert.show("Login failed, please try again!", "Login info");
break;
}
}
]]>
</mx:Script>
<mx:HTTPService showBusyCursor="true" id="loginRequest" method="POST" useProxy="false" url="http://venomnote/php/user_verify.php">
<mx:request xmlns="">
<uname>
{uname.text}
</uname>
<passwd>
{passwd.text}
</passwd>
</mx:request>
</mx:HTTPService>
<mx:Dissolve id="dissolveOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Dissolve id="dissolveIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
<mx:TitleWindow visible="{cblbox.selected}" showEffect="{dissolveIn}" hideEffect="{dissolveOut}" id="titwin" width="294" height="156" layout="absolute" title="Login Box" showCloseButton="false" horizontalCenter="1" verticalCenter="0" cornerRadius="0" alpha="0.5">
<mx:Form horizontalCenter="0" verticalCenter="0">
<mx:FormItem label="Username">
<mx:TextInput id="uname"/>
</mx:FormItem>
<mx:FormItem label="Password">
<mx:TextInput displayAsPassword="true" id="passwd"/>
</mx:FormItem>
<mx:Button label="Login" width="235" click="costam();" id="button1"/>
</mx:Form>
</mx:TitleWindow>
<mx:ApplicationControlBar dock="{cbdock.selected}" horizontalCenter="0" bottom="50" width="75%">
<mx:HBox width="100%" verticalAlign="middle" horizontalAlign="left">
<mx:CheckBox id="cbdock" label="Docked"/>
<mx:CheckBox id="cblbox" label="Login Box"/>
</mx:HBox>
<mx:HBox width="100%" verticalAlign="middle" horizontalAlign="right">
<mx:Label text="Control Bar"/>
</mx:HBox>
</mx:ApplicationControlBar>
</mx:Application>
what bothers me is this msg:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at test/::costam()
at test/__button1_click()
i'm total newB in as3 and flex 2, but im intermediate PHP and Delphi programmer, so please try not to yell at me :)
thx