Executing JavaScript in a Flash HTML TextField is both cool and a little scary. You can throw some inline JavaScript in your htmlText to dynamically specify a pop up window size when using target=”_blank.” This works in both ActionScript 2.0 and ActionScript 3.0.

Pop up Window Example:

Example of Inline Java Script

Get Adobe Flash player

(click on the link above to open a 200 x 300 pop up window)

// myTextField is a dynamic text field instance on the stage
var link:String = "http://www.blackcj.com/"
var jsText:String = "window.open('" + link + "','win','height=200,width=300,toolbar=no,scrollbars=yes'); void(0);"
myTextField.htmlText = "<a href=\"javascript:" + jsText + "\"><u>blackcj.com</u></a>";

Any JavaScript tag can be run this way. Try adding an alert right after the window.open script. Notice how they both execute. Yet another reason to ALWAYS validate your input fields when displaying htmlText. Nothing worse than somebody adding some inline JavaScript to your Flash form.