danielhordern.com
Sample News
Flash MXFlash 5

XML - an improved solution?

Although the flash UI works as expected, the ASP solution is hard on the server - three database querries are made - to find out the total number of records, the number of pages (given a client supplied page size) then finally the articles for the client requested page. The results are encoded and sent back to the flash client with fixed variable names - not a major issue, but not the prettiest solution.

Another solution could be to use the action-script xml object. This supports requesting xml data from a url, and a combined send xml/ load xml from a url.

action-script / flash prepares a simple xmldoc to send to the ASP pages

<news_articles>
<style heading_colour="#ffff00"
author_color="#00ff00"
date_colour="#ff0000"
article_color="#000000"
seperator_color="#0000ff"/>
<page = "1">
<pageSize="3">
</news_articles>

flash_news.asp parses the xml-doc to retrieve the requested page-number, and the colours to apply to the simple html when generating the articles html. The news_functions.asp builds a resulting xml doc (using a single database query, and adding properties to the result xmldoc) formatted something like this

<news_articles>
<page = "n">
<pages="n">
<records="n">
<text> simple html of articles for page "n"</text>
</news_articles>

 

Benefits

  • Less load on server - ASP code executes less database querries. Flash can assign vars / post info in a more structured manner.

  • ASP and Flash client can add content to the conversation without breaking anything.

  • Flash client ASP functions and html client ASP can possibly be folded into the a single set of nicely structured functionality - internally using xml (this sounds attractive!)

Are these changes worth the effort?