I’m having a problem with recording data sent out of Flash to a database. It is exported as an XML string and then parsed by an ASP file. The weird thing is that when I send the data with a “_blank” parameter to pop open a new window, the data is recorded in the database just fine. But I don’t want a blank window to pop up. When I change that parameter to null the results are not recorded. What am I doing wrong? Below is an example of my code. The first line works, the second line doesn’t.
You can log in as a user by entering the letter g as both your username and password. I am trying to capture the user’s answers to questions about an image they view on the screen.
Parameters
url The destination URL for the specified XML object.
window The browser window to display data returned by the server: _self specifies the current frame in the current window, _blank specifies a new window, _parent specifies the parent of the current frame, and _top specifies the top-level frame in the current window. This parameter is optional; if no window parameter is specified, it is the same as specifying _self .
Returns
Nothing.
Description
Method; encodes the specified XML object into an XML document and sends it to the specified URL using the POST method.
apparently you don’t have to specify a window if you don’t want another page to open
Well that brings up another weird thing…it’s valid to just enter the script URL in parentheses and nothing else, but then Flash uses the GET method instead of POST. And in my testing, only POST worked to get any kind of response at all.
I solved the problem, or at least hacked it. I decided to use sendAndLoad() instead of just send(). Even though I don’t need to load anything at that point, I created an XML object called dummyData and I sent a bogus XML string to it from the ASP file:
Hi Joe, thanks! I tried sendAndLoad() first without the return object but it still wasn’t working. It wasn’t until I set up the dummy object and sent a string to it that entries began appearing in the database.
Is it really a Flash problem with send() or is it possible there was something in the asp file causing the problem? I don’t do the asp part, my colleague does–so we have a lot of friendly arguments over whose “fault” it is when something doesn’t work. This time we decided it was flash’s fault!