0

Flash slideshow + Event Gateways = COOL

ColdFusion
I was tasked with integrating some kind of cool slideshow for our company's intranet page.  My solution to making that a cool project was to use a Flash app, and then use CF MX 7 event gateways to monitor the image directory for any changes, then re-write the XML file on any Add/Change/Delete. 



I used the DirectoryWatcher event gateway in ColdFusion and on any Add/Change/Delete to my designated directory, it kicks off the code to re-write the source XML file for the .swf movie.


Here is the code I used to generate the new source XML file for the movie.

<cfscript>
directoryList = createObject("java","java.io.File").init(expandPath("./activepics/")).list();
</cfscript>

<cfdump var="#directoryList#">

<cfsavecontent variable="output">

<slideshow>
    <cfloop index="i" from=1 to="#arrayLen(directoryList)#">
       
            <cfoutput>
            <slide>
                <image url='somePath/#directoryList[i]#'                 background='555555' />
                <transition transition='push_left' />
                <motion duration='2' start_xOffset='-200' />
            </slide>
            </cfoutput>
     
    </cfloop>
</slideshow>   
</cfsavecontent>

<cffile action="write" file="#expandpath("slides.xml")#" output="#output#"/>

 
If you click on the Flash slideshow it will take you to the source page...or you can d/l the source I used here.
tags:
ColdFusion

Search

Fuelly