• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

How do I bind the result of HTTPService to a HTML component...

Dear Experts,

How do I bind or direct the results of either HTTPService requests to the HTML component?



<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>


<![CDATA[

import mx.controls.Alert;

private function Login():void {
      
        httpSvcLogin.send();
       
}
private function User():void {
      
       
        httpAdduser.send();
}
 
]]>
</mx:Script>


<mx:HTTPService resultFormat="e4x"  id="httpSvcLogin" url="http://localhost/index.php?login=check" showBusyCursor="true" useProxy="false" method="POST">
      <mx:request xmlns="">
      <username>admin</username>
      <password>1234</password>
      </mx:request>
</mx:HTTPService>

<mx:HTTPService resultFormat="e4x"  id="httpAdduser" url="http://l/index.php?sec=user" showBusyCursor="true" useProxy="false" method="POST">
      <mx:request xmlns="">
          <action>add</action>
          <username>Joel+Sisko</username>
      </mx:request>
</mx:HTTPService>


<mx:Button x="22" y="10" label="login" click="Login();"/>
<mx:Button x="83" y="10" label="Add User" click="User();"/>
<mx:HTML width="100%" height="100%" y="40"/>

</mx:WindowedApplication>
0
Joel_Sisko
Asked:
Joel_Sisko
  • 2
  • 2
1 Solution
 
evcrCommented:
See below,

However I cannot see the point of doing it this way when you can just point the html to the url of those pages.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 
<mx:Script>
 
 
<![CDATA[
 
import mx.controls.Alert;
import mx.events.*
 
private function Login():void {
	httpSvcLogin.send();
}
private function User():void {
	httpAdduser.send();
}
 
private function loginResult(event:Event):void {
	htmlWindow.htmlText = httpSvcLogin.lastResult.toString();
}
 
private function userResult(event:Event):void {
	htmlWindow.htmlText = httpAdduser.lastResult.toString();
}
 
]]>
</mx:Script>
 
 
<mx:HTTPService result="loginResult(event)" resultFormat="e4x" id="httpSvcLogin" url="http://localhost/eedemos/test.php" showBusyCursor="true" useProxy="false" method="POST">
      <mx:request xmlns="">
      <username>admin</username>
      <password>1234</password>
      </mx:request>
</mx:HTTPService>
 
<mx:HTTPService result="userResult(event)" resultFormat="e4x" id="httpAdduser" url="http://localhost/eedemos/test.php" showBusyCursor="true" useProxy="false" method="POST">
      <mx:request xmlns="">
          <action>add</action>
          <username>Joel+Sisko</username>
      </mx:request>
</mx:HTTPService>
 
 
<mx:Button x="22" y="10" label="login" click="Login();"/>
<mx:Button x="83" y="10" label="Add User" click="User();"/>
<mx:HTML width="100%" height="100%" y="40" id="htmlWindow"/>
 
</mx:WindowedApplication>

Open in new window

0
 
Joel_SiskoAuthor Commented:
If I use the location parameter the for the HTML component, is that not a separate session from the HttpService  that is sending the request?

Joel
0
 
Joel_SiskoAuthor Commented:
It did what I needed it to do. Thanks for all the help once again.

Question on the return resultFormat, should it be "text" or "e4x" or something else?

Joel
0
 
evcrCommented:
q1. I think if you look through the html component that's proabably what it does.

q2. I think it should be text, as it's not xml your returning.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now