Flex SWF in a cfwindow
Posted By : todd sharp Posted At : June 25, 2007 1:39 PM Posted In: Flex, ColdFusion
7
I had a thought the other day about a good use case for a Flex application within a cfwindow and went about trying to test the concept. In my initial testing I had some difficulty getting the SWF to load. I assumed it had something to do with the Active Content JavaScript files that Flex HTML wrappers use to include the SWF in the HTML template.
Long story short I decided to go back and RTFM where I found this caveat:
Adobe recommends that you include all custom JavaScript in external .js files and import them on the application's main page, and not write them inline in code that you get using the source attribute
The catch here is including external JS files in the main page, not the source of the window (which is what I had been trying to do).
So moving the external JS includes from the HTML wrapper to the main page seems to work flawlessly.
Here is a simple demo.
Here's the code:
<script src="AC_OETags.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript" src="history.js"></script>
<cfwindow name="test" source="helloworld.html" initShow="true">
</cfwindow>
Stay tuned to see why I wanted to do this :)
Thanks to Dan Vega for whipping up the quick Flex app for me!



Any idea how to get a pdf into a cfwindow?
index.cfm:
<cfajaximport tags="cfwindow">
<a href="##" onClick="ColdFusion.Window.create('theWindow', 'hasChart','chart.cfm')">Click here</a>
chart.cfm:
<cfchart>
<cfchartseries type="pie">
<cfchartdata value="25" item="things">
<cfchartdata value="25" item="stuff">
<cfchartdata value="50" item="shenanigans">
</cfchartseries>
</cfchart>
Any suggestions would be much appreciated.
As a workaround try using a JPG chart.
Or try putting the chart inside an <iframe> - that *might* work - but probably not...
I've been trying to create a cfwindow that contains a flash video - using the very ubiquitous Jeroen Wijering's FLVPlayer and swfobject.js.
It seems to work if the code is all included in the parent page. But if I call an external file as the source of the cfwindow - and that file contains the swfobject javascript, I get an error that says:
Error processing JavaScript in markup for element winName_body: [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
I have no idea why it does not work with the javascript on the source page.
Any thoughts would be appreciated.
I am also through the same problem [Only the FLV files does not work , my other mpeg files work there]
Instead of function foo(){}
The JS must be formatted such:
foo = function(){}