First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Tiran Dagan | Website: http://www.TiranDagan.com

The synopsis of ths FLA file attached to this tutorial is as follows:

1. Frame one -  we load the XML file, and read the various tags supporting the desired structure of the table.

2. Frame two - Position the single column and last column objects outside the work area. Duplicate the column objects for each column specified in the XML file. Position labels at the top of the column, and presto!

Here's the code for frame one (reading the XML file): 

var ColumnDefs = new Array();
var numColumns;

tableXML=new XML();
// read the XML file. This can be replaced with a url to an ASP which generates the
// XML file based on a SQL database query, for example:
// tableXML.load ("/tablestruct.asp?getrecs=5")
tableXML.load("XMLcondensed.htm");
tableXML.onLoad = loadedXML;
stop ();

function loadedXML()
{
	var columnProperties = new Array();

	allText = tableXML.firstChild;
	td=allText.firstChild;
	tablename=td.attributes.tablename;
	numColumns=int(td.childNodes.length);
	columndef=td.firstChild;
	for (i=0;i<numcolumns;i++) {

	// iterate between the  tags
		if (columndef.nodeName <> "columndef") {
			trace ("Error!: Was expecting a 'columndef' field, but not found");
			trace ("Element name: " + columndef.nodeName);
			err=1;
		} else {
			// Each element of ColumnDefs is an array of the
			// XML tags defining the column properties.
			// We are creating an associative array which allows 
			// us to address the title of column 3 of the table as:
			// ColumnDefs[2]["title"]
			ColumnDefs.push ();
			ColumnDefs[i]=new Array();
			for (j=0;j<columndef.childNodes.length;j++) {
				attr=columndef.childNodes[j].nodeName;
				ColumnDefs[i][attr]=columndef.childNodes[j].firstChild.nodeValue;
				eval("node_" + attr)=columndef.childNodes[j].firstChild;
			}

			columndef=columndef.nextSibling;
		}
	}
	_root.gotoAndStop(2);
}
» Level Advanced

Added: 2001-10-01
Rating: 7 Votes: 38
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.