Tim asks:
Michael White posted the question of a button in a Flash form that opens up a new window. How would you implement this? I know adding the javascript function to an "onClick" doesnt work.
So, onClick is definitely how to start. I built code for this for my Lighthouse Pro project. Let's look at the code (which can probably be done better) and I'll explain what I did...
function show(u) {
if(u != '') window.open(u, 'sub', 'directories=yes, location=yes, menubar=yes, resizable=yes, scrollbar=yes, status=yes, titlebar=yes, toolbar=yes')
}
</script>
<cfform format="flash" name="foo" width="400" height="200">
<cfformgroup type="horizontal">
<cfinput type="text" validate="url" name="theURL" width="150" message="Use a proper URL">
<cfinput type="button" name="showURL" value="Load in New Window" width="150"
onClick="getURL('javascript:show(\''+theURL.text+'\')')">
</cfformgroup>
</cfform>
I start off with the code I'll use to open a new window. This is your fairly standard "window.open" code. It may - in fact - get blocked by pop up blockers. My Firefox never complained though. Anyway, that being said, the code is pretty standard. Unlike most popups, I don't specify a height and width. This tends to let the browser use the defaults, which is the same size as the user's main window.
Next comes our flash form. I didn't know where you wanted the new window to go, so I added a simple text input box for a URL. The button is what we really care about. For some reason it took me numerous tries to get all the escaping and string parsing done right here. Basically we use getURL, which is a Flash method that lets you talk to JavaScript. I'm calling my "show" JavaScript function defined above, and passing in the value of the text input box. Obviously you don't have to have a text input box. Maybe it is a static URL, or something from a grid, but you get the idea.