I am a fairly new to Flash and OOP. I am working on a project that has us at the point where we are communicating with the server. I am familiar with the various methods to communicate Flash with external data.
I have studied many tutorials, books, and both the Flash and ASP forums on this site and I have yet to come up with suggestions for returning datasets (multiple records) from a server to flash.
Here, my goal is to send a request to the server to return some basic information about the top 20 news stories stored in the server. I have come up with an un-tested solution and thought I would get some advice from the experts to see if I am even going down the right road for this type of need.
This would be designed to parse a dataset that could contain hundreds of records (my reason for asking if this is the best method for that requirement). For this example, the return XML dataset would look something like this.
Lastly, how would I destroy the XML objects when I am finished with them to free up memory on the client's machine.
Your help is greatly appreciated.
ToddWW
I have studied many tutorials, books, and both the Flash and ASP forums on this site and I have yet to come up with suggestions for returning datasets (multiple records) from a server to flash.
Here, my goal is to send a request to the server to return some basic information about the top 20 news stories stored in the server. I have come up with an un-tested solution and thought I would get some advice from the experts to see if I am even going down the right road for this type of need.
Code:
var serverURL:String = "[URL unfurl="true"]http://www.myserver.com/news.cgi"[/URL]
on (release) {
// Creates an XML object <newsrequest category="sports" />
xmlReq = new XML();
xmlElement = xmlReq.createElement("newsrequest");
xmlElement.attributes.category = "sports";
xmlReq.appendChild(xmlElement);
// Creates an XML object for the server's reply
xmlReply = new XML();
xmlReply.onLoad = onServerReply;
// Sends the XML to the Server
// Reply goes into the xmlReply object
xmlReq.sendAndLoad(serverURL,xmlReply);
}
function onServerReply() {
// Use various XML Class methods to iterate through
// the XML DataSet and create Flash Objects, etc..
}
This would be designed to parse a dataset that could contain hundreds of records (my reason for asking if this is the best method for that requirement). For this example, the return XML dataset would look something like this.
Code:
<news>
<story id="65122341" subject="St. Louis Wins World Series" date="11/15/06" />
<story id="15234421" subject="San Diego get's ready for Denver" date="12/05/06" />
// and so on .... up to 100s of records.
<news>
Lastly, how would I destroy the XML objects when I am finished with them to free up memory on the client's machine.
Your help is greatly appreciated.
ToddWW