So, I wanted to create a dynamic cfpresentation and display it in inside a cfwindow. The concept seems very simple and straight forward. However, it was anything but. Creating the presentation was the easy part. The hard part was putting it into cfwindow. After a few failed attempts I got it working.

The first thing I tried was to simply put it the presentation in between the cfwindow tags. This was a test to see if the presentation would load in the window.

view plain print about
1<CFWINDOW HEIGHT="480" WIDTH="640" MODAL="TRUE" CLOSABLE="TRUE" INITSHOW="TRUE">
2    <CFPRESENTATION TITLE="Test Presentation" CONTROL="BRIEF" SHOWNOTES="NO" SHOWOUTLINE="NO" SHOWSEARCH="NO" AUTOPLAY="YES" LOOP="YES">
3        <CFPRESENTATIONSLIDE DURATION="30">                            
4            <IMG SRC="./testimage1.jpg" />
5        </CFPRESENTATIONSLIDE>
6        <CFPRESENTATIONSLIDE DURATION="30">                            
7            <IMG SRC="./testimage2.jpg" />
8        </CFPRESENTATIONSLIDE>
9    </CFPRESENTATION>
10</CFWINDOW>

What actually happened here was that the presentation loaded full screen outside of the cfwindow. In checking the source I see that the code for the cfwindow is there but no window was created.

My next attempt was to use ColdFusion.Window.create to generate a window and have it call a cfm file that generates the document.

view plain print about
1<HTML><HEAD></HEAD><BODY>
2<CFIF IsDefined('url.doPres')>
3    <CFPRESENTATION TITLE="Test Presentation" CONTROL="BRIEF" SHOWNOTES="NO" SHOWOUTLINE="NO" SHOWSEARCH="NO" AUTOPLAY="YES" LOOP="YES">
4        <CFPRESENTATIONSLIDE DURATION="30">                            
5            <IMG SRC="./testimage1.jpg" />
6        </CFPRESENTATIONSLIDE>
7        <CFPRESENTATIONSLIDE DURATION="30">                            
8            <IMG SRC="./testimage2.jpg" />
9        </CFPRESENTATIONSLIDE>
10    </CFPRESENTATION>
11<CFELSE>
12    <CFAJAXIMPORT TAGS="cfwindow">
13    <SCRIPT LANGUAGE="JAVASCRIPT">
14        ColdFusion.Window.create('Window1', 'Presentation Window', './index.cfm?doPres=1', {REFRESHONSHOW:true,height:480,width:640,modal:true,closable:true, draggable:true,resizable:false,center:true,initshow:true});
15    </SCRIPT>
16</CFIF>
17</BODY></HTML>

This however, generated a never ending javascript error loop. The presentation was never loaded but the window appeared this time. Using Firebug, I verified that the window was in fact trying to load the presentation so I was making progress.

Since I had gone this far and was not about to give up. I had one more trick up my sleeve. This is a trick I used to get around the problem of cfwindow appearing on top of flash elements and having them bleed through. The time I decided to try and have the presentation load into an iframe inside the window.

view plain print about
1<HTML><HEAD></HEAD><BODY>
2<CFIF IsDefined('url.doPres')>
3    <CFIF url.doPres EQ 1>
4        <IFRAME SRC="./index.cfm?doPres=2" WIDTH="100%" HEIGHT="100%" FRAMEBORDER="0"></IFRAME>
5    <CFELSE>
6        <CFPRESENTATION TITLE="Test Presentation" CONTROL="BRIEF" SHOWNOTES="NO" SHOWOUTLINE="NO" SHOWSEARCH="NO" AUTOPLAY="YES" LOOP="YES">
7            <CFPRESENTATIONSLIDE DURATION="30">                            
8                <IMG SRC="./testimage1.jpg" />
9            </CFPRESENTATIONSLIDE>
10            <CFPRESENTATIONSLIDE DURATION="30">                            
11                <IMG SRC="./testimage2.jpg" />
12            </CFPRESENTATIONSLIDE>
13        </CFPRESENTATION>    
14    </CFIF>
15<CFELSE>
16    <CFAJAXIMPORT TAGS="cfwindow">
17    <SCRIPT LANGUAGE="JAVASCRIPT">
18        ColdFusion.Window.create('Window1', 'Presentation Window', './index.cfm?doPres=1', {REFRESHONSHOW:true,height:480,width:640,modal:true,closable:true, draggable:true,resizable:false,center:true,initshow:true});
19    </SCRIPT>
20</CFIF>
21</BODY></HTML>

This time it actually worked. The presentation loaded inside the window as expected and worked. The presentation scaled nicely into the window. I did not notice any other issues by doing this. But I must admit I did not do much testing beyond getting it to load.

Until next time...

--Dave