Hi,

You not using and object in send()

http.send("?testID=SomeIDNumber")

do;

http.send({testID:someIDNumber})

PS, It really does help to read the docs, they spell this stuff out.

Peace, Mike



On 6/18/06, Peter Farland <[EMAIL PROTECTED]> wrote:

Did you import the type?
 
import mx.rpc.events.ResultEvent;
 
Do you have the rpc.swc in the classpath?
 
 
Also, to use the MXML tag in ActionScript, be sure to use the mxml subpackage version of HTTPService, i.e.
 
import mx.rpc.http.mxml.HTTPService;

 

From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of NZEYIMANA Emery Fabrice
Sent: Saturday, June 17, 2006 8:47 AM
To: flexcoders@yahoogroups.com
Cc: Mac Martine
Subject: Re: [flexcoders] Using HTTPService in a function

Thanks Martine,
I have read from the manuals and tutorials and tried to do the following:
 

private function SampleFunction():void
{
 var http:HTTPService;
 
 http = new HTTPService();
 http.url = "">
http://www.domain.com/my_xml.php ";
 http.method="POST";
 http.useProxy = false;
 http.showBusyCursor = true;
 http.resultFormat = "text";


 http.addEventListener( "result", xmlReceived );

 http.send();

}

 
private function xmlReceived(event:ResultEvent):void
{
    var myXML:String;
    myXML
= event.toString();
 
    // Do something with the XML
}
 
 
The application cannot compile because it says that the ResultEvent Type cannot be found.
I even tried to private function xmlReceived(event:mx.rpc.events.ResultEvent):void but it doesn't solve the problem.
The error message I receive is "Type was not found or was not a compile-time constant: ResultEvent."
 
 
Thanks
Emery
----- Original Message -----
From: Mac Martine
Sent: Saturday, June 17, 2006 08:13
Subject: RE: [flexcoders] Using HTTPService in a function

It's because at the point that you do:

myXML = http.lastResult.toString();

… the result of the service has not yet been received. You need to create an event listener to let you know when the service has completed it's call.

The event listener will then trigger a result function that you create, and in that function is where you should get the result (myXML = http.lastResult.toString();

) and do whatever you want with it.

-Mac


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of NZEYIMANA Emery Fabrice
Sent: Friday, June 16, 2006 5:07 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Using HTTPService in a function

Hello Group,

I am new here and seeking help from you.

I have created a function in my Flex application and would like to use the HTTPService object from retreiving XML data from my webservice (based on PHP).

All the examples I have seen on the Adobe website use same approach (that I don't like) of binding the object to some controls.

What I trying to achieve is: Create an HTTP object, instruct that object to retreive a web XML string, store that string locally in a variable.

Using the code I have provided below, the application gives an error saying that the object is not yet created (null). And if I watch the task bar after the error message (in Firefox), I see that the flash application is accessing the webXML.

What might be wrong?

private function SampleFunction():void
{
 var http:HTTPService;
 var myXML:String;
 
 http = new HTTPService();
 http.url = "">
http://www.domain.com/my_xml.php";
 http.method="POST";
 http.useProxy = false;
 http.showBusyCursor = true;
 http.resultFormat = "text";
 http.send();

myXML = http.lastResult.toString();

// Do something with XML


}




--
What goes up, does come down. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to