Passing certain URL variables to a SWF within a ColdFusion.

From: rabidGadfly

Using SWFObject to place my Flash objects.

customvars=user_id,123456;eyecolor,blue;car,accord

Then, in my CF page I put the following code which converts the customvars string into a CF structure:

<cfset flashVars = structNew() />
<cfparam name="url.customvars" default="">
<cfif len(url.customvars)>
<cfloop list="#url.customvars#" delimiters=";" index="customFlashVar">
<cfset thisRecordName = listFirst(customFlashVar,",")>
<cfset thisRecordValue = listLast(customFlashVar,",")>
<cfset flashVars[thisRecordName] = thisRecordValue>
</cfloop>
</cfif>

Then, in my swfObject code, I loop through the structure assigning the name and variable to swfObject's addVariables like this:

<cfloop collection="#flashVars#" item="key">
fo.addVariable("#key#","#attributes.parms[key]#");
</cfloop>

Comments
Comments are not allowed for this entry.
BloggArt  |  Portfolio  |  Contact          BloggArt is running BlogCFC version 5.5.