homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

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

5+ Year Member

Msg#: 3040236 posted 6:06 pm on Aug 9, 2006 (gmt 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!



5+ Year Member

Msg#: 3040236 posted 3:23 am on Aug 15, 2006 (gmt 0)

chnage your trace line to...

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved