Imx Fix in my experience
 
« prev next »

November 19, 2003 4:58 AM


As of this writing, and as far as I know, in the Flash MX 2004 TextArea component, Macromedia missed an important detail when they created the TextArea component properties. You can say that the text area can be formatted by HTML, but that HTML formatting inherits the whitespace formatting as though a supersetted 'pre' tag was present. It makes for ugliness, and requires ugly workarounds (AFAIK). I sent email to the author of a good article that mentions this issue. In the article he said...
Now, a quick note on ignoreWhite: this normally excludes all spaces, linebreaks and carriage-returns from being counted when our XML is brought in to Flash (parsed), however I must admit I can't get it to work in my example or the Macromedia example I looked at earlier - you can see this for yourself by inserting a carriage return after one of the opening tags and then viewing the results in Flash - if anyone knows why this happens then please email me so I can amend this tutorial. I've left it in for the time being :]
I've been playing around with this, and have a few notes. First, condenseWhite would probably be the property to use/set as that is what is available in a dynamic text box (as opposed to ignoreWhite).

Unfortunately, it looks as though Macromedia did not implement that property in the TextArea component (and because components are compiled, you can't add that property support). If you remove all white space from the original xml doc (and you still have to use ignoreWhite while loading the XML) you can fix some of the display weirdness. That's a less than optimal solution though.

I may have to figure out how to write my own component, but that looks like it's out of my league right now.

<update when="November 22, 2003">

I wrote a function that deals with this problem...

	// This function kills any characters in the passed in string
	// that are considered to be white space. White space is defined
	// as anything *below* ASCII/Unicode character code 32.
	// We want code 32 because that's a space, and we want words separated, right?	

	function killWhiteSpace(theData) {
		var myNewString:String = '';
		var j:Number;
		  for(j = 0; j < theData.length; j++) {
			  if(theData.charCodeAt(j) > 31) {
				  myNewString += theData.charAt(j);
				  }
		  }
		 return myNewString;
	}
Use this function before you place your HTML into a TextArea component.

</update>