From: TheScarecrow on
I have a list of videos and I want the user to click on one. This loads the
Flash movie page where the movie they clicked on loads. The code would get the
video from a UIRL variable. However, what I do not know how to do is get the
CF Code to load the movie. Does anyone know how to do this? Thanks :smile;

From: imaaxa on
I know there has to be a more simple way of doing this, but my work around was
to place a flash player into my page so Dreamweaver would do most of the
coding. The name of the .flv file is in the code twice. So I coped all of the
code up to (but not including) the first entry of the .flv file name and pasted
it into a MySQL table. Then I did the same thing for the code after the first
..flv file name, and again for the code after the second time the .flv file name
is listed. So now the code that Dreamweaver generated should now be divided up
and stored in your MySQL table with out the .flv file name. It will be placed
into the code later. (I left the file path in the code so all I have to do is
build the code with these three data cells and the file name.)

Next I did a SQL call from my cfc to get the data from the table:

<cfinvoke
component="cfc.flashCode" method="flash1" returnvariable="qFlash1"></cfinvoke>
<cfinvoke
component="cfc.flashCode" method="flash2" returnvariable="qFlash2"></cfinvoke>
<cfinvoke
component="cfc.flashCode" method="flash3" returnvariable="qFlash3"></cfinvoke>

Test for a url variable and assign it to a variable named video, and if it is
not defined give it a default value.
<cfif isdefined("url.message")>
<cfset video="#url.message#">
<cfelse>
<cfset video="open.flv">
</cfif>

Then where I want the flash video to be I entered this code:

<!--- This build the player code and inputs the video name in both places--->

<cfoutput>#qFlash1.sData##video##qFlash2.sData##video##qFlash3.sData#</cfoutput>

Next is the list of .flv videos. I started with a cfc SQL call to get the
list:

<cfinvoke component="cfc.flvList" method="flvsToPlay"
returnvariable="qFlvs"></cfinvoke>

Then I entered the code to make the list with a link tag that builds a link
and passes the name of the .flv with the url

<table border="0">
<cfoutput query="qFlvs">
<tr>
<td>
<!--- Here is the link that passes the name with the url then
displays the name as a link--->
<a href="/services/media.cfm?message=#qFlvs.name#">#qFlvs.name#</a>
</td>
</tr>
</cfoutput>
</table>

This is working as of now. Here is the flashCode.cfc code to work with the
MySQL tables.

<cfcomponent displayName="flashCode.cfc" hint="Works with the flashCode
Database">

<!--- Gets and Returns a the first storage slot in the flashCode
Database --->
<cffunction name="flash1" access="public" returnType="query">
<cfquery name="qFlash1">
SELECT colName
FROM table
WHERE Id=1
</cfquery>
<cfreturn qFlash1>
</cffunction>

<!--- Gets and Returns a the second storage slot in the flashCode
Database --->
<cffunction name="flash2" access="public" returnType="query">
<cfquery name="qFlash2">
SELECT colName
FROM table
WHERE Id=2
</cfquery>
<cfreturn qFlash2>
</cffunction>

<!--- Gets and Returns a the third storage slot in the flashCode
Database --->
<cffunction name="flash3" access="public" returnType="query">
<cfquery name="qFlash3">
SELECT colName
FROM table
WHERE Id=3
</cfquery>
<cfreturn qFlash3>
</cffunction>
</cfcomponent>

Here is the flvList.cfc code to work with the MySQL tables.

<cfcomponent displayName="flvList" hint="Works with the flvList Database">
<cffunction name="flvsToPlay" access="public" returntype="query">
<cfquery>
SELECT name
FROM flvTableName
ORDER BY id DESC
</cfquery>
<cfreturn qFlvs>
</cffunction>
</cfcomponent>

I hope I made this easy enough to follow, and you can use it. If some one
knows of an easier way to do this I could also use it. Thanks