I just completed a rather large Flash application - 4 interfaces comprising 1400 - 1700 lines of code each with a .NET/SQL back-end.

Unfortunately, some parts of it don't seem to like the new Flash player. Naturally, I'm not about to recode this thing - I'll wait till we start on version 2. ;)

Most of it seems to be performing fairly gracefully with the new player, though the sendAndLoad object seems to be a touch flaky - I'll have to do more testing with that. It's irritating to have a rock-solid application suddenly go wobbly just because a new player was released.

What I really need help with, is one function in particular that used array operators to search and replace text as users type it. It will sporadically truncate the input text in Flash Player 7, but works perfectly with player versions 6,0,47 and 6,0,79.

I haven't yet pinned down exactly which operation is failing - I'm gonna try to design a test that does that.

In the meantime, I would appreciate it if anyone could point out a possible point of failure and suggest a workaround. The function in question is quoted below:

/*
bowdlerizer code to clean up the chat
*/
//first we build an array of naughty words and a nice words array for replacement
//for obvious reasons, I'm not going to use a real word list in this example
naughtyWords = new Array("dirty", "underpants", "canadian");
niceWords = new Array("unhygenic", "abbreviated trousers", "Latitudinally Challenged");
//we also build a pair of arrays to handle dangerous characters
dangerousCharacters = new Array("<", ">", "&", '"', "%");
//escape the percent sign last to avoid escaping all the stuff you just escaped!
safeCharacters = new Array("%26lt;", "%26gt;", "%26amp;", "%26quot;", "%25");
//this function cleans up the chat to prevent undue embarrassment
function bowdlerize(inputString) {
//keep these vars from getting out into the wild
var x, y, cussCount, naughtyString, incidence, niceString, origString, origLCString, originalLCString, cleanLCString, dangerousString, safeString;
var naughtyLength = naughtyWords.length;
var dangerLength = dangerousCharacters.length;
//begin execution
cussCount = 0;
originalLCString = inputString.toLowerCase();
cleanLCString = originalLCString;
for (x=0; x<naughtyLength; x++) {
naughtyString = naughtyWords[x];
niceString = niceWords[x];
incidence = cleanLCString.indexOf(naughtyString);
if (incidence != -1) {
//we only do this so we can react to extreme use of expletives
cussCount++;
}
//by using array methods, we eliminate the need to do recursive searching
cleanLCString = cleanLCString.split(naughtyString).join(niceString);
}
//end step-through of naughty array
origInputArray = inputString.split(" ");
origLCArray = originalLCString.split(" ");
outputString = cleanLCString;
for (x=0; x<origLCArray.length; x++) {
origString = origInputArray[x];
origLCString = origLCArray[x];
outputString = outputString.split(origLCString).join(origString);
}
//end shuffle with matched words
//now we step through the dangerous characters array, and escape anything that might be interpreted as HTML
for (y=0; y<dangerLength; y++) {
dangerousString = dangerousCharacters[y];
safeString = safeCharacters[y];
outputString = outputString.split(dangerousString).jo in(safeString);
}
//end step-through of dangerous array
if (cussCount>2) {
//oops! too many naughty words at once.
clientAlert("<p align='center'>Remember that this discussion is being observed and recorded. <br><br>Please abstain from using expletives and racial slurs.</p>");
}
return (outputString);
}
//end function