Actionscript 2.0 Loop with XML

This piece of code I have below, has a limited number in its loop.

I need help creating a loop that will not rely on a maximum number.

Maybe a "while" loop? Im not sure how to implement this though... Please help!
MyXML = new XML();
MyXML.ignoreWhite = true;
MyXML.onLoad = function(ok) {
if (ok) {
// Loop Limit
_root.max_entries = 10;
for (var i = 0; i < _root.max_entries; i++) {
// Put XML Contents into Variables
_root.jtitle = this.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;
_root.jdate = this.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
_root.jtext = this.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue;				
// Duplicate Entry clip, and Assign New Dynamic Name
duplicateMovieClip (_root.entry_content.entry_info, "mc"+i, i);
// Wrap Size of Major Text Field to Size of Content
_root.entry_content["mc"+i].entry_txt.autoSize = "center";					
// Enter Text from XML Into Movie Clip
_root.entry_content["mc"+i].title_txt.text = _root.jtitle;
_root.entry_content["mc"+i].date_txt.text = _root.jdate;
_root.entry_content["mc"+i].entry_txt.text = _root.jtext;			
// Get the y value of the previous movieclip
var yval = getProperty(_root.entry_content["mc" + (i - 1)], _y);
	// trace("previous clip y position " + yval);
// Get the height value of the previous movieclip
var hval = getProperty(_root.entry_content["mc" + (i - 1)], _height)
	// trace("height of previous clip " + hval);
// Space in pixels between each clip
_root.mc_spacing = 10;
// Using the two figures from above, position the new movieclip
setProperty(_root.entry_content["mc"+i], _y, yval + (hval + _root.mc_spacing));
} else {
// If XML isn't loaded, trace error
trace('Error XML Not Loaded!');
// Load XML File

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

if (ok) {

xmlNodeLength = this.firstChild;
_root.max_entries = xmlNodeLength.childNodes.length;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
webrhpAuthor Commented:

Just curious, do you know how I can add links to my XML data that will work in the flash?
You first have to specify the textfield as a htmlText.

_root.entry_content["mc"+i].entry_txt.htmlText = _root.jtext;

Then in your xml file you can add html tags to create links. In order to do this though you have to enclose your content within CDATA tags. e.g.

            <title><![CDATA[Content Test]]</title>
            <date><![CDATA[November 11th, 2008]]</date>
            <text><![CDATA[This is a <a href="">link</a>]]</text>

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

webrhpAuthor Commented:
You are an unbelievable wealth of knowledge my friend! Thank you again.

Does this CDATA method allow only links. What about images?
webrhpAuthor Commented:
Ah ha! Nevermind!

It turns out, I have to embed my font's characters, and it seems to work perfectly!

Though Im still having some small issues with linking the image, everything is coming along very well.

Any ideas for image links?
This is the correct format for adding the information to the htmlText field.

blah.htmlText = "<a href=\"\" target=\"_blank\"><img src = \"1_p1.jpg\"><a>";

So I would imagine this might work within the xml file

<text><![CDATA[<a href="" target="_blank"><img src = "p1.jpg"><a>"]]</text>
webrhpAuthor Commented:
And it works!

Thank you again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.