That way works, but a better way is to process the event instead of
referencing lastResult on your HTTPService. The event itself is of
type ResultEvent, and you'd process is similar to the following:

<mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import mx.rpc.events.ResultEvent;
                        
                        protected function defaultResult(event:ResultEvent):void
                        {
                                var result:Object = event.result;
                                
                                if(result.errorCode > 0)
                                        Alert.show(result.errorText);
                        }
                ]]>
        </mx:Script>
        
        <mx:HTTPService 
                id="stations_info_request"
                url="http://web2/massmc/xml.php";
                useProxy="false" 
                method="POST" 
                showBusyCursor="true" 
                resultFormat="e4x"
                result="defaultResult(event)"/>

--- In [email protected], "Jason B" <[EMAIL PROTECTED]> wrote:
>
> Nevermind got it
> 
> 
>             
>             import mx.rpc.events.ResultEvent;
>             import mx.rpc.events.FaultEvent;
>             import mx.controls.Alert;
>             
>          public function resultHandler(event:Event):void{
>                        
> Alert.show(stations_info_request.lastResult.serverResponse.errorText,
> "Error");
>          }
> 
> 
> 
> 
> 
> <mx:HTTPService id="stations_info_request" url="xml.php" 
>       method="POST" showBusyCursor="true" 
>       result="resultHandler(event)">
> 
> 
> 
> 
> 
> 
> 
> 
> --- In [email protected], "Jason B" <nospam@> wrote:
> >
> > sorry no i did this function
> >             import mx.rpc.events.ResultEvent;
> >             import mx.rpc.events.FaultEvent;
> >             import mx.controls.Alert;
> >             
> >          public function defaultResult(infopassed){
> >             
> >             Alert.show(infopassed, "Error");
> >          }
> > 
> > 
> > 
> > --- In [email protected], "Jason B" <nospam@> wrote:
> > >
> > > Thanks Tracy
> > > I just attempted to do this i tried do this in a function....
> > > but i couldnt properly get it to pass the data to my function?
> > > 
> > > if(stations_info_request.lastResult.serverResponse.errorText!="")
> > >
> >
>
mx.controls.Alert.show(stations_info_request.lastResult.serverResponse.errorText)
> > > 
> > > example
> > > 
> > > <mx:HTTPService id="stations_info_request"
> > > url="http://web2/massmc/xml.php"; 
> > >   useProxy="false" method="POST" showBusyCursor="true" 
> > > 
> >
>
result="defaultResult(stations_info_request.lastResult.serverResponse.errorText);">
> > > 
> > > 
> > > in my action script i did
> > > 
> > > function defaultResult(MYPARAM){
> > > 
> > > mx.controls.Alert.show(MYPARAM)
> > > etc.
> > > }
> > > 
> > > No error occurs but no param passes to the alert box its just blank
> > > 
> > > 
> > > 
> > > --- In [email protected], "Tracy Spratt" <tspratt@> wrote:
> > > >
> > > > Ah, no.  In fact you might avoid using faults because the
> browser does
> > > > not pass the flash player any detail about the fault.
> > > > 
> > > >  
> > > > 
> > > > Do not bind directly to last result.  Use a result handler, and in
> > that
> > > > handler, inspect your result and decide how to handle it.
> > > > 
> > > >  
> > > > 
> > > > Tracy
> > > > 
> > > >  
> > > > 
> > > > ________________________________
> > > > 
> > > > From: [email protected]
> > [mailto:[EMAIL PROTECTED] On
> > > > Behalf Of Jason B
> > > > Sent: Monday, April 28, 2008 11:57 AM
> > > > To: [email protected]
> > > > Subject: [flexcoders] Re: how do you return an XML fault from
> > > > HTTPService?
> > > > 
> > > >  
> > > > 
> > > > ok maybe i missed something?
> > > > i now know this can trigger a fault but how do you handle it if
> a user
> > > > wants to just send back something other then the binded info? 
> > > > like say i am requesting all data for a form but that user doesnt
> > > > exist? How will i tell this to the user? I thought i had to use a
> > > > fault ...No?
> > > > 
> > > > --- In [email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > > > , "Tracy Spratt" <tspratt@> wrote:
> > > > >
> > > > > Have your data leave off a closing tag.
> > > > > 
> > > > > Tracy
> > > > > 
> > > > > 
> > > > > 
> > > > > ________________________________
> > > > > 
> > > > > From: [email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > > > [mailto:[email protected]
> > <mailto:flexcoders%40yahoogroups.com>
> > > > ] On
> > > > > Behalf Of Jason B
> > > > > Sent: Monday, April 28, 2008 11:19 AM
> > > > > To: [email protected]
> > <mailto:flexcoders%40yahoogroups.com> 
> > > > > Subject: [flexcoders] Re: how do you return an XML fault from
> > > > > HTTPService?
> > > > > 
> > > > > 
> > > > > 
> > > > > sorry but im not using Soap im just using HTTPService and on php
> > side
> > > > > returning my own made xml data as the book instructs?
> > > > > yea i do need to test this to verify how a fault will look in
> flex?
> > > > > 
> > > > > How is this not a flex question?
> > > > > 
> > > > > --- In [email protected]
> > > > <mailto:flexcoders%40yahoogroups.com>
> > > > <mailto:flexcoders%40yahoogroups.com>
> > > > > , "valdhor" <stevedepp@> wrote:
> > > > > >
> > > > > > Not really a Flex question but what are you trying to do? Is
> this
> > > > just
> > > > > > for testing purposes to see what your Flex app will do with a
> > > > > > SoapFault? If so, the easiest way is to invoke a method that
> does
> > > > not
> > > > > > exist.
> > > > > > 
> > > > > > 
> > > > > > --- In [email protected]
> > > > <mailto:flexcoders%40yahoogroups.com> 
> > > > > <mailto:flexcoders%40yahoogroups.com> , "Jason B" <nospam@>
wrote:
> > > > > > >
> > > > > > > how do you return an XML fault from HTTPService?
> > > > > > > 
> > > > > > > while i got it working just cannot figure out the xml that
> would
> > > > be
> > > > > > > returned to trigger this?
> > > > > > > no examples for this exist under google
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to