Groups | Blog | Home
all groups > coldfusion flash integration > october 2006 >

coldfusion flash integration : loadVars HELP!!


apexman
10/3/2006 2:27:15 PM
:disgust;
HELP anyone, please.

I'm trying to get flash to read a list. The flash and cfm files are in the
same directory. If I cut and paste the output from the cfm file into .txt file,
flash has no problem reading it! What's going on?

Here's my code on the coldfusion side:

<cfquery name="Recordset1" datasource="Staffinfo">
SELECT LASTNAME, FIRSTNAME
FROM stafflist
ORDER BY lastname
</cfquery>
<!--- create an array --->
<cfset myArray = ArrayNew(1)>

<!--- loop through query, append names successively to last element --->
<cfloop query = "Recordset1">
<cfset temp = ArrayAppend(myArray, "#lastName#")>
</cfloop>

<!--- show the resulting array as a list --->
<cfset myList = ArrayToList(myArray, ",")>

<!--- sort that array descending alphabetically --->
<cfset myAlphaArray = ArraySort(myArray, "textnocase", "desc")>

<!--- show the resulting alphabetized array as a list --->
<cfset myAlphaList = ArrayToList(myArray, ",")>
vars=<cfoutput>#myList#</cfoutput>



Here's my cold on the Flash Side:

myVars=new LoadVars();
thevars="variables.cfm";
myVars.load(thevars);
myVars.onLoad=function(){
trace(myVars.vars);
}
button_btn.onRelease=function(){
trace(myVars.vars);
}[h]Text[/h][h]Text[/h][Q]Text[/Q][h]Text[/h][h]Text[/h]
Andrew Davis
10/4/2006 9:34:16 AM
loadvars acutually loads a .txt file, not a webpage. you have a few choices:

1. have the .cfm page save ( use cffile) a .txt file with the created
output and have flash read that. add an include to the cfm page on the
page that the flash is embeded on, so when you initially call the flash
page in a browser it writes the txt file. then read it into flash. if
you need a list that is dynamically updated within the flash application
use remting instead.

2. read the info in using flash remoting (more complicated but in the
end very useful and elegant, easy to setup if you are using coldfusion)


[quoted text, click to view]
AddThis Social Bookmark Button