The date you want is in an attribute, so try:

[EMAIL PROTECTED] == "true

http://livedocs.macromedia.com/flex/2/docs/00001910.html

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of oneproofdk
Sent: Friday, January 19, 2007 7:42 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Getting the values from a HTTPservice xml result

 

I'm trying to put together a small "login" app - mainly to see how I
can post data and capture the result. So far I've only been using
Bindable ArrayCollection's.

The thing is, that I can't figure out how to access the values, when
the data is in "e4x" format.

I've had a go with the Vipercreations PHP login tutorial, but can't
really make it work.

Thanks for any help you can provide.

My source is below, the xml result is here (when logged in successfully)
<action parameter="login">
<login success="true"/>
<user id="1" login="mark" lang="da"/>
</action>

Regards,
Mark

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;

[Bindable]
public var arrLang: Array = [ {label:"Dansk", data:"da"}, 
{label:"English", data:"en"}, {label:"Svenska",
data:"sv"} ];

[Bindable]
public var selectedLang:Object; 

private function sendLogin():void {
login_user.send();
} 

private function checkLogin(event:ResultEvent):void {
var xmlResult:XML = XML(event.result);
if (xmlResult.action.login.success == "true") {
Alert.show("Welcome"); 
} else {
Alert.show(xmlResult.toXMLString());
}
}

private function checkUser_listener(event:ResultEvent):void {
var xmlResult:XML = XML(event.result);
Alert.show(xmlResult.toXMLString()); //you shuld see your xml.
}
]]>
</mx:Script>
<mx:HTTPService
id="login_user"
result="checkLogin(event)"
method="POST"
url="asp/xml/xml.asp"
useProxy="false"
resultFormat="e4x"
>
<mx:request xmlns="">
<action>login</action>
<login>
{login.text}
</login>
<pass>
{pass.text}
</pass>
<lang>
{selectedLang.data}
</lang>
</mx:request>
</mx:HTTPService>
<mx:Panel width="350" height="250" layout="absolute"
horizontalAlign="center" verticalAlign="middle" id="mainLogin"
title="Login" horizontalCenter="16" verticalCenter="27.5">
<mx:Label y="23" text="Login :" x="50"/>
<mx:TextInput y="39" width="230" id="login" x="50"/>
<mx:Label y="66" text="Password :" x="50"/>
<mx:TextInput y="81" width="230" id="pass" displayAsPassword="true"
maxChars="10" x="50"/>
<mx:Label x="50" y="111"/>
<mx:ComboBox x="50" y="111" id="lang" dataProvider="{arrLang}"
close="selectedLang=ComboBox(event.target).selectedItem"
creationComplete="selectedLang=ComboBox(event.target).selectedItem"/>
<mx:Button x="137" y="152" label="Login" click="sendLogin();"/>
</mx:Panel>

</mx:Application>

 

Reply via email to