Cool, I think I understand. I'll give it a try.
Thanks. ~Steve http://lanctr.com/ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Wednesday, April 23, 2008 2:02 PM To: [email protected] Subject: RE: [flexcoders] newbie question That is ok, but it is the hard way. HTTPService is easier to use. So you have the string you need in the completeHandler? If so, then I guess I don't understand your question. If you need to 'save" that string for later use by some other function, you could declare an "instance" (global) variable and store it in that. Declare that var outside of any function: private var _sMyString:String; then in completeHandler(): _sMyString = event.target.data.resultCode; Now you can access that value from most anywhere. That warning is from the function declaration: public function postData(){ To fix it do: public function postData():void{ This declares the return type of the function to be "void" Tracy _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Good Sent: Wednesday, April 23, 2008 2:10 PM To: [email protected] Subject: RE: [flexcoders] newbie question Sorry about the subject, I'm not sure why I didn't use something more descriptive. Here's a snippet of the code I'm using. public function postData(){ var urlData:String = "foo=bar"; trace(urlData); var variables:URLVariables = new URLVariables(urlData); var request:URLRequest = new URLRequest(); request.url = "http://domain.com/remoteScript.cfm"; request.method = URLRequestMethod.POST; request.data = variables; var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.addEventListener(Event.COMPLETE, completeHandler); try { loader.load(request); } catch (error:Error) { trace("Unable to load URL"); } function completeHandler(event:Event):void { trace(event.target.data.resultCode); } } I don't know if this is the best way to do this, I just copied and modified one of the examples at http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_co mmunications_3.html The string I'm trying to get is in the last trace, resultCode. FB3 does show a warning about the function. "-1008: return value for function 'postData' has no type declaration." I don't have a clue what this means. I have a Flex 3 book on order, so hopefully I can bring my dumb questions down to a minimum once I get my hands on it. Thanks! ~Steve http://lanctr.com/ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Wednesday, April 23, 2008 1:06 PM To: [email protected] Subject: RE: [flexcoders] newbie question Welcome, Steve. First, please use a descriptive subject for all posts, including "AIR", if you think that might be signficant. There is too much traffic on this list for anyone to read all posts, so we choose what to read based on the subject. Subjects like "HELP ME!!!" and "URGENT!!!", and even "Newbie Question" stand a good chance of being skipped. Now, for your question, I do not use AIR much yet, but generally, you need to use a result handler on your data call. That function will be called when your data returns, and you can then do whatever you need with it. Are you using RemoteObject to make the call? All the of the RPC protocols support the result event. Tracy _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Good Sent: Wednesday, April 23, 2008 1:44 PM To: flexcoders Subject: [flexcoders] newbie question Let me start by saying that I am completely new to Flex and obviously the list. I'll apologize upfront for asking the dumb and obvious questions, but I'm still going to ask them :P So here's a description of what I'm doing and my question. I built an Air app with Flex 3 that posts some form data to a remote cfm file. The cfm file then returns a string. If I watch the app running in the Flex Builder 3 debug perspective I can see the string that's returned. My question is this. How do I get that string and make it available to another function? I want to use the returned string in another post method in the same app. If more details are required I can give them, just holler J and Thanks in advance. ~Steve http://lanctr.com/ __________ Information from ESET NOD32 Antivirus, version of virus signature database 3049 (20080423) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

