Hello Group,
I still have a problem with the HTTPService.
It ignores the request parameters I pass to it.
Also, I set the request method to POST but my PHP script shows me that the method is GET.
 
<mx:Script>
        <![CDATA[
   
        import mx.rpc.events.ResultEvent;
        import mx.rpc.http.mxml.HTTPService;
       
        private function SampleFunction(event:Event):void
        {
            var http:HTTPService;
       
            http = new HTTPService();
            http.url = ""http://www.domain.com/my_xml.php">http://www.domain.com/my_xml.php";
           
            http.method="POST"; // This is ignored and Flash sends GET
            http.useProxy = false;
            http.request = "testID=SomeIDNumber"; //This is ignored
            // I also tried "?testID=SomeIDNumber" but it is still ignored
            http.showBusyCursor = true;
            http.resultFormat = "xml";
                   
            http.addEventListener(ResultEvent.RESULT, xmlReceived);
            http.send();
            // I also tried to pass the request like http.send("testID=SomeIDNumber") and http.send("?testID=SomeIDNumber") but it is still ignored 
        }
            
        ]]>
    </mx:Script>
   
Can anybody tell me what's wrong?
 
 
 
Thanks
Emery
 
----- Original Message -----
Sent: Saturday, June 17, 2006 19:17
Subject: Re: [flexcoders] Re: Using HTTPService in a function

I know this has been answerd but here is a sample from your code.

Peace, Mike


<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="SampleFunction(event)"
    layout="absolute">

    <mx:Script>
        <![CDATA[
   
        import mx.rpc.events.ResultEvent;
        import mx.rpc.http.mxml.HTTPService;
       
        private function SampleFunction(event:Event):void
        {
            var http:HTTPService;
       
            http = new HTTPService();
            http.url = ""http://www.domain.com/my_xml.php">http://www.domain.com/my_xml.php";
           
            http.method="POST";
            http.useProxy = false;
            http.showBusyCursor = true;
            http.resultFormat = "xml";
                   
            http.addEventListener(ResultEvent.RESULT, xmlReceived);
            http.send();
        }
     
        private function xmlReceived(event:ResultEvent):void
        {
            var myXML:String;
            myXML = event.result as XML;
             trace(myXML);
            // Do something with the XML
        }
           
           
        ]]>
    </mx:Script>
   
</mx:Application>



On 6/17/06, NZEYIMANA Emery Fabrice <[EMAIL PROTECTED]> wrote:

Thank you very much.
I imported the class and it now works.

Thanks to you Geoffrey and Martine for the help.

Emery



--- In flexcoders@yahoogroups.com, "Geoffrey Williams" <[EMAIL PROTECTED]> wrote:
>
> Are you importing the class?
>
> import mx.rpc.events.ResultEvent;
>
> --- In flexcoders@yahoogroups.com, "NZEYIMANA Emery Fabrice"
> <nzeyimana@> wrote:
> >
> > Thanks Martine,
> > I have read from the manuals 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" target=_blank>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."
>




--
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