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>
LVL 12
Joel_SiskoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.