I have a client who is having a big problem with an AS2 application we developed a few years ago.
As far as I can tell, it is being caused by an acknowledged bug in recent versions of Flash Player (see http://forums.adobe.com/message/3859034 and https://bugbase.adobe.com/index.cfm?event=bug&id=2941694).
Two versions of FP are affected (10.3.183.5 and 10.3.183.7), and the bug was fixed in 10.3.183.10.
Obviously, upgrading Flash Player will fix the problem, but we all know users don't always do this and she has been getting emails about the problem.
I am contemplating having her update the SWFObject code to explicitly detect for 10.3.183.10 and have ExpressInstall "encourage" users to upgrade, but I don't know if this will fly.
I have tried several of the workaround that searches have uncovered, but none are working in my case.
I was wondering if anyone has found a reliable way to fix this?
First thing I would try would be to use the textField.htmlText instead of textField.text and see if that doesn't solve it (although I would be surprised if it did).
Second potential way I can see fixing this (and this is really not pretty) is to manually wordwrap. The following is in AS3 because that's what I use. I'll leave it to you to convert it to AS2 but I assume this should be possible in AS2 as well.
var text : String = "some text here";
var textField : TextField = new TextField();
textField.wordwrap = false;
textField.multiline = false;
textField.autosize = false;
textField.width = MAX_TEXT_WIDTH;
//other formatting stuff
var words : Array = text.split(" ");
var line : String = words[0];
textField.text = words[0];
var lines : Array = new Array();//will contain all lines
for(var i : int = 1; i < words.length; ++i)//start at second word
{
textField.text += " " + words[i];//try adding another word to the line
if(textField.textWidth > MAX_TEXT_WIDTH)//overflowed line
{
lines.push(line);
line = words[i];
textField.text = line;
}
else//doesn't overflow, line is still valid
{
lines += textField.text;
}
}
lines.push(line);
var text : String = lines[0];
for(i = 1; i < lines.length; ++i)
{
text += "\n" + lines[i];
}
textField.multiline = true;
textField.height = lines.length * HEIGHT_PER_LINE;//HEIGHT_PER_LINE can be found using getLineMetrics and
//adding gutter pixels to the height - might have to
//play a little with this
textField.text = text;
Not sure this compiles (it's probly not AS2 compatible anyways) but this should give the general idea. Do the wordwrapping yourself and see if that works. Also make sure that the formatting is applying to the text while you are checking for textWidth. I think you need to call setTextFormat(myTextFormat) everytime you change the textField.text value.
I also saw that apparently multiline might not work in that version. If that is the case, you might have to make a new TextField object for each line and offset their y values to make it look like it's the same TextField (hopefully you aren't using borders or backgrounds on your textFields if this is the case)
Now that the issue is fixed, it's unlikely anybody will bother coming up with a workaround. Probably the SWFObject method you suggested is the way to go. Just check if the version is within 10.3.183.5 and 10.3.183.7 and, if so, display the ExpressInstall.
The final AS version I think works best is
the_textfield.autoSize = false;
the_textfield.multiline = false;
the_textfield.wordWrap = false;
var words : Array = the_textfield.text.split(" ");
var line : String = words[0];
the_textfield.text = words[0];
var lines : Array = new Array();
for (var i : Number = 1; i < words.length; ++i) {
the_textfield.text += " " + words[i];
if (the_textfield.textWidth > SOME_WIDTH) {
lines.push(line);
line = words[i];
the_textfield.text = line;
} else {
line += " " + words[i];
}
}
lines.push(line);
var t : String = lines[0];
for (i = 1; i < lines.length; ++i) {
t += "\n" + lines[i];
}
the_textfield.text = t;
the_textfield.autoSize = true;
the_textfield.multiline = true;
the_textfield.wordWrap = false;
In my case, I had to futz with SOME_WIDTH
, but the textfield was authored and there are some weird scaling things going on, so I just figured out the number empirically.