By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,045 Members | 2,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,045 IT Pros & Developers. It's quick & easy.

[Flash8] Dynamic Text Fields / XML / spacing

P: 2
So I have a project where there are 5 dynamic text fields, and I thought it would be quite simple. Create a dynamic text field, and then load in the .xml content, and I had it complete. However, it turns out that spacing is quite important, so my method will not work, and I'm kind of stumped how to proceed. Here is a visual representation of how it is layed out:



So the things highlighted in red represent the .xml nodes, and as the width (character count) of TEAM1 and TEAM2 change, the spacing needs to remain consistant, and the static elements (the "vs." and "|" need to move accordingly, and the TEAMLOCATIONS need to stay lined up as well...

Does anyone have a good idea how to handle this, or a good tutorial they could point out? I'm trying to build my own array structure, and calculate the width of "TEAM1", but it's slow going... Any ideas would be greatly appreciated.

Here's the source code without the spacing stuff happening:
[PHP]
function loadXML(loaded) {
if (loaded) {
_root.teamcity1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.teamname1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
city_txt.text = _root.teamcity1;
name_txt.text = _root.teamname1;
_root.teamcity2 = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.teamname2 = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
city2_txt.text = _root.teamcity2;
name2_txt.text = _root.teamname2;
_root.thetime = this.firstChild.childNodes[0].childNodes[4].firstChild.nodeValue;
time_txt.text = _root.thetime;
} else {
content = "file not loaded!";
}
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("games.xml");[/PHP]

And the XML

[PHP]<?xml version="1.0" encoding="ISO-8859-1"?>

<games>
<team>
<city1>BALTIMORE</city1>
<name1>REDSKINS</name1>
<city2>CINCINNATI</city2>
<name2>BENGALS</name2>
<thetime>12:00ET</thetime>
</team>
</games>[/PHP]


Thanks!

-EmoJoy
Aug 18 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.