PDA

View Full Version : cant get Flex to talk to DB


autokad
04-21-2009, 07:15 PM
I tried getting my flex to talk to a database but it wouldnt work, so i simplified things to just flex and the asp page, but I cant get the HTTP service to work, i put in every form of event listener for the serivce as well and they never get executed. I have a crossdomain.xml file that works so that shouldnt be the isue. Any suggestions?

here is my asp file:
Response.Write("Hello");

and my mxml file:
<mx:Form x="22" y="10" width="493">
<mx:HBox>
<mx:Label text="Username"/>
<mx:TextInput id="username" text="karl"/>
</mx:HBox>
<mx:Button label="Submit" click="send_data()"/>
</mx:Form>

<mx:HTTPService id="userRequest" url="x.x.x.x/test.asp"
useProxy="true" method="POST" resultFormat="text">
<mx:request xmlns="">
<username>{username.text}</username>
</mx:request>
</mx:HTTPService>

in the script:

private function send_data():void {

//userRequest.addEventListener(FaultEvent.FAULT,test 1);
//userRequest.addEventListener(Event.ACTIVATE,test1) ;
//userRequest.addEventListener(InvokeEvent.INVOKE,te st1);
userRequest.addEventListener(ResultEvent.RESULT,te st1);
userRequest.send();

}

autokad
04-22-2009, 08:41 PM
even though my asp is returning xml as
<users>
<user>
<userid>1</userid>
<username>karl</username>
<emailaddress>karl_dailey@hotmail.com</emailaddress>
</user>
<user>
<userid>2</userid>
<username>karl2</username>
<emailaddress>karl_dailey2@hotmail.com</emailaddress>
</user>
</users>

my mxml hs to be:
<mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.user}">

notice its not userRequest.lastResult.users like whats posted in online examples or what you would expect,, hehe :P