Invoking Servlets in Flash MX

Hello, I’m new here… and hope some kind souls would help me out here?

Our project scope
My friend and I are working on this Flash application that retrieves data from a IBM DB2 database and displays it. We read somewhere that Flash can’t connect directly to a database, thus some middleware is required. So we are using JSP or servlets for our middleware.

The problem
In our best (but limited haha) knowledge, we understand that we need to first declare an XML object, and then use a Load method to invoke a servlet that accesses the database and fills the XML object with records of the database. Finally it’ll return the filled object back to Flash. Are we correct in this sense?

Er, the problem is, we have no idea on how the servlet code works. We can successfully connect to the DB2 database and retrieve records, though. Can anyone help us out here?

We would appreciate greatly. Thanks! :slight_smile:

Another not-so-important question
Btw, we did try loading a XML file into a XML object. However, it’s wierd. This is our XML file:


<?xml version="1.0" encoding="UTF-8"?>
<test>
	<bubble>Hello</bubble>
	<bubble2>Hello hello</bubblewat>
</test>

To retrieve Hello Hello from bubble2, we used this patch of ActionScript:


doc.load("text.xml"); 
doc.onLoad = waitLoad;

function waitLoad()
{
test = doc.childNodes[1].childNodes[3].childNodes[0];
trace(test.nodeName);
}

Notice, in order to get the 2nd nested child of TEXT we would need to use .childNodes[3], instead of .childNodes[2]. Is that how Flash goes? That each increment is by… 2? But at least, it works…

That’s why it’s so wierd… lol. Headache man!