# Loading data out of flash into database

**URL:** <https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461>\
**Category:** programming\
**Created:** [August 18, 2004, 7:23pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461 "2004-08-18T19:23:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_ellington](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@d\_ellington](https://forum.kirupa.com/u/d_ellington)\
**Post date:** [August 18, 2004, 7:23pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/1 "2004-08-18T19:23:28Z")

</div>

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.

> [FONT=Arial][SIZE=1]xmlData.send(“[http://interactive.elon.edu/clinicalimagingrecord.asp](http://interactive.elon.edu/clinicalimagingrecord.asp)”, “\_blank”, “POST”);  
> xmlData.send(“[http://interactive.elon.edu/clinicalimagingrecord.asp](http://interactive.elon.edu/clinicalimagingrecord.asp)”, null, “POST”);[/SIZE][/FONT]

The project is here:

[http://interactive.elon.edu/imaging.html](http://interactive.elon.edu/imaging.html)

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.

TIA!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2004, 7:31pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/2 "2004-08-18T19:31:36Z")

</div>

try

```auto

xmlData.send("http://interactive.elon.edu/clinicalimagingrecord.asp", 0, "POST");

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2004, 7:40pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/3 "2004-08-18T19:40:08Z")

</div>

Thanks, but that gives me an action script error when I try to publish:

```auto

**Error** Scene=login, layer=quiz ?s, frame=47:Line 136: Type mismatch.
     	xmlData.send("http://interactive.elon.edu/clinicalimagingrecord.asp", 0, "POST");

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2004, 7:58pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/4 "2004-08-18T19:58:46Z")

</div>

from macromedia’s site

> 

XML.send

Availability  
Flash Player 5.

Usage

myXML .send( url, [window])

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2004, 8:25pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/5 "2004-08-18T20:25:08Z")

</div>

> [@Digitalosophy](#):
>
> from macromedia’s site  
> 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:

```auto

xmlData.sendAndLoad("http://interactive.elon.edu/clinicalimagingrecord.asp", dummyData);

```

And now the entries show up in the database just fine. Isn’t that odd?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2004, 10:08pm UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/6 "2004-08-18T22:08:04Z")

</div>

No.  
send was always causing this problem.  
You don’t even need to use the return object from sendAndLoad btw…or even set it up/ send anything back.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 10:40am UTC](https://forum.kirupa.com/t/loading-data-out-of-flash-into-database/61461/7 "2004-08-19T10:40:40Z")

</div>

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!
