homepage Welcome to WebmasterWorld Guest from 107.22.45.61
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
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.
catcherintherye51




msg:3040238
 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)));
};
};
myVilla.load("myxml.xml");

Here's the XML:

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

And here are the trace results, which is the last 4 characters in the XML string converted into a number:
0
580
458
595
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!

 

dareRock




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

chnage your trace line to...
trace(substring(this.picHolder.attributes.xy,5,7));

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved