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";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson