PDA

View Full Version : Calling a URL


MadamZuZu
04-24-2007, 07:50 PM
hi :)

this is a very stupid newby question.

i can't figure out how to call a url on a click on a button, i understand that i need to have httpservices... so i have htis:

<mx:HTTPService id="sanData"
url="{myURL}"/>

but, what do i put for "onclick"?

Thanks!

MadamZuZu
04-24-2007, 08:02 PM
this is what i'm doing:

<mx:Script>
<![CDATA[
public function submitForm():void
{
formSender.send();
}
]]>
</mx:Script>

<mx:HTTPService id="formSender" url="http://google.com"/>


and this is what im getting:

[RPC Fault faultString="Error #1090: XML parser failure: element is malformed." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

dr_zeus
04-24-2007, 09:21 PM
Do you want the browser to load google.com? If this is the case, you don't want to use HTTPService. Instead, you want to use the navigateToURL function (http://livedocs.adobe.com/flex/201/html/passingarguments_086_11.html). The HTTPService is meant to load the actual content from an URL, such as XML data, into a Flex application.

MadamZuZu
04-25-2007, 01:07 AM
perfect! thank you :)