Search tutorials
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 |
| » Author |
| No details available. |
| » Download |
| Download the files used in this tutorial. |
| Download (8 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


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