Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Strange XML values

Reads first 4 values correctly, then all heck breaks loose.

6:06 pm on Aug 9, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 11, 2005
votes: 0

I have a script that reads xy values in XML and creates 2 separate values with a substring command.

It seems to read the first 4 results correctly, then all heck breaks loose. Even though I have 6 data points it shows the first 4 correct, then shows 2 more in the trace that don't exist in my XML.

Here's the loop that reads the values form XML:

myVilla = new XML();
myVilla.ignoreWhite = true;
myVilla.onLoad = function(success) {
numimages = this.firstChild.childNodes.length;
for (i=0; i<numimages; i++) {
this.picHolder = this.firstChild.childNodes[i];
this.thumbHolder = image_tn.createEmptyMovieClip("thumbnail"+i, i);
this.thumbHolder._x = Number(substring(this.picHolder.attributes.xy,0,4) );
this.thumbHolder._y = Number(substring(this.picHolder.attributes.xy,5,7) );
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
this.thumbLoader.attachMovie("Dot", "Dot"+i, this.getNextHighestDepth());
trace(Number(substring(this.picHolder.attributes.x y,5,7)));

Here's the XML:

<img xy="00000000" />
<img xy="03080580" />
<img xy="04200458" />
<img xy="03670595" />
<img xy="03600650" />
<img xy="03800605" />

And here are the trace results, which is the last 4 characters in the XML string converted into a number:
424 //should be 650
389 //should be 605

I'm not sure where it's getting the 424 and 389 since they aren't in my XML.

Any ideas? This is VERY strange!

3:23 am on Aug 15, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:July 31, 2005
votes: 0

chnage your trace line to...

then see what happens...also the xy had whitespace b/w them, but that wasn't the problem


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members