Dynamic pages that are passing strings to Flash that may contain characters that need to be escaped.
A simple CFC that you pass the string to, and get back one that can be used with an inline Flash call. Fixes & and quotes. Can easily be modified, or converted into a custom tag.
<CFCOMPONENT DISPLAYNAME="FlashStringRx"
HINT="Takes all your & worries away">
<CFFUNCTION ACCESS="public"
NAME="Escape"
OUTPUT="true"
RETURNTYPE="string">
<!---
Code to use:
<CFINVOKE COMPONENT="FlashStringRx"
METHOD="Escape"
RETURNVARIABLE="getString">
<CFINVOKEARGUMENT NAME="agString"
VALUE="">
<CFINVOKEARGUMENT NAME="agTrim"
VALUE="0">
</CFINVOKE>
Results:
Returns the string w/ Flash chars escaped. agTrim turns
Trim() on/off (1/0)
--->
<CFARGUMENT NAME="agString"
DEFAULT=""
REQUIRED="no"
TYPE="string">
<CFARGUMENT NAME="agTrim"
DEFAULT=1
REQUIRED="no"
TYPE="numeric">
<CFSET ARGUMENTS.agString = Replace(ARGUMENTS.agString,
"&", "%26", "All")>
<CFSET ARGUMENTS.agString = Replace(ARGUMENTS.agString,
"#Chr(34)#", """, "All")>
<CFIF agTrim EQ 1>
<CFSET getString = Trim(ARGUMENTS.agString)>
<CFELSE>
<CFSET getString = ARGUMENTS.agString>
</CFIF>
<CFRETURN getString>
</CFFUNCTION>
</CFCOMPONENT>
+