Flex SWF in a cfwindow

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:

<!--- .js files from the flex html wrapper --->
<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!

Comments
Very cool.

Any idea how to get a pdf into a cfwindow?
# Posted By Sam Farmer | 6/25/07 7:19 PM
I have not been able to get that working yet myself - but to be honest I really haven't tried that hard.
# Posted By todd sharp | 6/29/07 9:30 AM
I am trying to get a cfchart in a cfwindow but it doesn't behave properly in IE7. Here is the code:

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.
# Posted By Howard Ross | 6/3/08 1:02 PM
I tried working with that before, unfortunately I couldn't get it working.

As a workaround try using a JPG chart.

Or try putting the chart inside an <iframe> - that *might* work - but probably not...
# Posted By todd sharp | 6/4/08 10:25 AM

Calendar

Sun Mon Tue Wed Thu Fri Sat
  12345
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31   

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex misc model-glue off topic personal project learn slidesix sql

Recent Comments

More CF+Java: Compiling Classes And Persisting Objects
Getburl said: I have been attempting to get Db4o working in my CF application and I have not succeeded. I would lo... [More]

Thoughts On Ajax Frameworks And ColdFusion/Adobe
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

Extending Ext With Ext Extensions
Erast said: http://fanniecollins.10gb... emo http://gracetrevino.phree...... [More]

CF Needs An Open Source Contact List Importer
Kay Smoljak said: Heh, the fact that sites DO it doesn't mean they SHOULD. To us it's ok, but to a non-tech-savvy user... [More]

A Few Project Updates
Helena said: Now punctually what is the situation ? [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com