It's pretty easy, how you do it depends on which version of Flash you want to support.
For both Flash 5 & Flash MX you surround your object tag (the Flash embedding code) with <CFOUTPUT> tags, care must be taken with your code to double hash so that you can escape the three uses of the # in the code.
For Flash 5 you then add the value of the URL variable at the end of the two addresses for the SWF in just the same way that a normal URL variable is created:
<cfoutput>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=6,0,65,0"
width="550"
height="400"
id="myFlashMovie">
<param name="movie" value="myFlashMovie.swf?UserID=#url.UserID#">
<param name="quality" value="high">
<param name="bgcolor" value="##FFFFFF">
<embed src="myFlashMovie.swf?UserID=#url.UserID#"
width="550"
height="400"
autostart="false"
quality="high"
bgcolor="##FFFFFF"
NAME="myFlashMovie"
ALIGN=""
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
</cfoutput>
Flash MX introduced a new parameter "FlashVars" that can be used in the code for passing parameters:
<cfoutput>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=6,0,65,0"
width="550"
height="400"
id="myFlashMovie">
<param name="movie" value="myFlashMovie.swf">
<param name="quality" value="high">
<param name="bgcolor" value="##FFFFFF">
<param name="flashvars" value="UserID=#url.UserID#">
<embed src="myFlashMovie.swf"
width="550"
height="400"
autostart="false"
quality="high"
bgcolor="##FFFFFF"
FlashVars="UserID=#url.UserID#"
NAME="myFlashMovie"
ALIGN=""
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
</cfoutput>
I hope that helps, did you know that we also have a mailing list for Flash users that this kind of question could also have been answered on called FUGLI:
http://lists.daemon.com.au/cgi-bin/lyris.pl?enter=fugli&text_mode=0&lang=english
Andrew
Craig Riley wrote:
Hi,
Does anybody know how to set flash up so that if somebody clicks on a link containing an ID then flash will detect it and change accordingly?
eg. http://www.mysite.com/flashgame.cfm?UserID=65
The flash game is one file and I need it to detect if a user ID is defined when the flash is loaded and then make a decision. Now I know I can import variables from components using remoting and from the address line of a separate coldfusion page that builds up a url from variables in a DB (or whatever) but I'm not sure how to check if an ID exists within the url of the page that holds the flash.
(The game basically allows users to challenge friends via email, sending them a url that contains an ID so the game can recognize who challenged them)
Any help MUCH appreciated
Regards
Craig
-- Andrew Muller Senior Macromedia Certified Instructor - ColdFusion, Flash Certified Advanced Macromedia ColdFusion Developer Certified Macromedia Flash Developer
Daemon Internet Consultants [EMAIL PROTECTED] T:61 2 9380 4162 F:61 2 9380 4204 17 Roslyn Gardens Elizabeth Bay NSW 2011 AUSTRALIA Daemon: Serious Web Development MX DownUnder: The First AsiaPac Macromedia Devcon! http://www.mxdu.com/ --- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
