  | |  | Dynamic build of "nodePath "? - Ideas Please | Dynamic build of "nodePath "? - Ideas Please
2004-02-13 - By Ryan Hefner
Back Coders of the Net,
?
I will try to keep this short but thorough.? I am building an application
that dynamically builds its navigation based on the XML file that is loaded
into it.? This would be no problem if it were just one layer deep, but the
navigation has to accommodate for an infinite number of childNodes, that is
childNodes[i] may have childNodes and those childNodes may have childNodes
and so on.? Right now I have a function that dynamically builds the nodePath
based on an array that is passed to it.? This function builds the nodePath
just fine and returns it where I need it, but its in String form and cannot
be used within the test portion of the FOR loop that needs to iterate
through in order to build that childNodes portion.
?
Here is the basic code of the two functions that I am using to try to make
this work.? Any suggestions on code changes or a new approach would be
greatly appreciated.
?
CODE__
?
// buildNodePath function is passed an array (startClipNum) containing an
unset number of elements.
// It uses a FOR loop to iterate through startClipNum.length
// example: startClipNum = [3, 2, 0];
// buildNodePath(startClipNum);
// string returned “_root.navXML.childNodes[3].childNodes[2].childNodes[0].childeNodes.length?;
function buildNodePath(startClipNum) {
nodePathText = “_root.navXML?;
for(Ii= 0; i < startClipNum.length; i++) {
nodeTextPath += ?.childNodes[? + startClipNum[i] + “]?;
}
nodePathText += ?.childNodes.length?;
return nodePathText;
}
?
function buildNav(startClipNum, xOffset, yOffset) {
for(i=0; i <buildNodePath(startClipNum); i++) {
etc?.
}
}
?
?
Thanks a lot in advance for any help on this.
?
//Ryan
?
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104153
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |