CFLib.org – Common Function Library Project

Vars2Flash(varList, loadVar[, delim])

Last updated September 20, 2004

author

Joshua Miller

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This function takes 2 parameters: varList - a delimited list of variable names to load into a Flash movie and loadVar - the variable to append to the end of the string to tell Flash that all the variables are loaded. An optional delimiter can be passed as with any ListX() function.

Return Values:
Returns a Flash safe string.

Example:

<cfset var1="Sample Variable One">
<cfset var2="Sample Variable Two">
<cfset varList="var1,var2">
<cfoutput>#vars2Flash(varList,"datacomplete")#</cfoutput>

Parameters:

Name Description Required
varList A list of variable names, not the values themselves. Yes
loadVar A variable to append to tell Flash the variables are loaded. Yes
delim Optional delimiter. Defaults to a comma. No

Full UDF Source:

/**
 * Converts a list of variable names to a Flash safe string to pass into a Flash movie.
 * 
 * @param varList 	 A list of variable names, not the values themselves. (Required)
 * @param loadVar 	 A variable to append to tell Flash the variables are loaded. (Required)
 * @param delim 	 Optional delimiter. Defaults to a comma. (Optional)
 * @return Returns a Flash safe string. 
 * @author Joshua Miller (josh@joshuasmiller.com) 
 * @version 1, September 20, 2004 
 */
function vars2Flash(varList,loadVar){
	var i=1;
	var argc = ArrayLen(arguments);
	var outputString="";
        var delim = "";

	if (argc EQ 2) {
		ArrayAppend(arguments,',');
	}
	delim = arguments[3];
	for(i=1;i lte ListLen(varList);i=i+1){
		outputString="#outputString#&#ListGetAt(varList,i,delim)#=#evaluate(ListGetAt(varList,i,delim))#";
	}
	return "#outputstring#&#loadVar#=yes";
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson