A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: ereee!! Whitespace - ignoreWhite??

  1. #1
    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?

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    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

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    296
    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.

  4. #4
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    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

  5. #5
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center