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;				
	//trace(_root.jtitle);
	//trace(_root.jdate);
	//trace(_root.jtext);
 
// 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
MyXML.load('../xml/journal.xml');

Open in new window

webrhpAsked:
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.

crooksy88Commented:
if (ok) {

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

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:
Excellent!

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

e.g.
_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.

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

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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

Does this CDATA method allow only links. What about images?
0
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?
0
crooksy88Commented:
This is the correct format for adding the information to the htmlText field.

blah.htmlText = "<a href=\"http://maps.google.com\" target=\"_blank\"><img src = \"1_p1.jpg\"><a>";

So I would imagine this might work within the xml file

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

Thank you again
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.