-
anyone used the ignoreWhite property? know how to set it?
thx, very frustrated at this point. oh.. and one more thing. is...
myXML.childNodes[2]; and
myXML.firstChild.firstChild;
the same thing?
-
Senior Member
First thing the whitespace command only works for people with the latest versions of flash, so if they have an earlier version then it will not work.
A better option is to get the whitespace stripped out using this code:
http://www.moock.org/asdg/codedepot/
Go to the very last script on the page and you should find a fla file with whitespace stripping code. This will work with any flash player.
For your second question they are not the same.
The first one is the second child of myXML.
myXML.childNodes[2]; and
< myXML >
< Child > Number 1 < /Child>
< Child > Number 2 < /Child> <---***
</ myXML >
While the second is the first child of the first child of myXML
myXML.firstChild.firstChild;
< myXML >
< Child >
< ChildChild >data< /ChildChild> <---***
< /Child>
< /myXML >
Thanks
Luke
-
the whitespace issue:
unfortunately, the internal flash player of the flash 5 application is the one with the whitespace problem. This means you should use a whitespace stripper during development, and it doesn't really hurt to leave it in there when you publish, even though all only the very first version 5 players had this problem.
-
Senior Member
I would recommend that if you use the whitespace stripper during development that you leave it in for production code. Otherwise you may end up with all sorts of extra problems, once you release your flash into the wild.
Either set your code so that it ignores whitespace, or leave a whitespace stripper in.
Thanks
Luke
-
Senior Member
Don't rely on people having the most up to date flash player, always assume the worst and then you're project will most likely work.
You can use this whitespace stripper that moock wrote; (visit http://www.moock.org )
Code:
function cutWhitespace (xmlObjectToParse) {
for (var i = 0; i<xmlObjectToParse.childNodes.length; i++) {
if (xmlObjectToParse.childNodes[i].nodeType == 3) {
var j = 0;
var empty = true;
for (j=0; j<xmlObjectToParse.childNodes[i].nodeValue.length; j++) {
if (xmlObjectToParse.childNodes[i].nodeValue.charCodeAt(j)>32) {
empty = false;
}
break;
}
}
if (empty) {
xmlObjectToParse.childNodes[i].removeNode();
}
for (var k = 0; k<xmlObjectToParse.childNodes.length; k++) {
var cutSubNodes = xmlObjectToParse.childNodes[k];
cutWhitespace(cutSubNodes);
}
}
}
Put a call to this code in your xml object's onload statement
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|