retrotron
04-22-2003, 04:07 AM
Perhaps there is someone who knows a simple solution to my problem. I hope so, since my deadline is rapidly approaching.
When I use LoadVars.sendAndLoad() to gather the output from a .cfm file, the variables are not evaluated but rather are displayed in Flash as unevaluated ColdFusion variables (e.g. #myVariable#).
My varsData.cfm contains this code:
<cfset msg = "hello world!">
<cfoutput> &output=#msg#& </cfoutput>
My Flash has nothing but a large dynamic text box (named "results_txt") with a standard component button (named "load_btn"). The ActionScript reads:
// create a new LoadVars instance
thisVars = new LoadVars();
// load the variables when the button is clicked
load_btn.onRelease = function() {
// send thisVars to "varsData.cfm", put results in thisVars
thisVars.sendAndLoad("varsData.cfm", thisVars);
} // end onRelease function()
// swonking function
thisVars.onLoad = function(success) { // check if vars all loaded
if (success) { // vars completely loaded
trace("success");
formatText();
} else { // The data didn’t load at all. Display error
trace("error: data didn't load");
} // end "if (success)" statament
} // end swonking function
// set the text
function formatText() {
_root.results_txt.text = thisVars.output;
} // end formatText()
// stop the movie
stop();
When I test the movie and click the button, I get "#msg#" rather than "hello world!" displayed in the textfield. I obviously need #msg# to be evaluated to "hello world!". Can anyone shed some light on why this is happening and how I am to fix the problem?
Pax et bonum,
retrotron
PS. Someone told me this issue corrected by Macromedia is the solution: http://www.macromedia.com/support/flash/ts/documents/load_xdomain.htm. However, I am developing and testing all on a local machine, so it shouldn't have a problem with cross-domain interaction. Also, I don't think I understand the instructions at said site very well, they are too ambiguous for me.
When I use LoadVars.sendAndLoad() to gather the output from a .cfm file, the variables are not evaluated but rather are displayed in Flash as unevaluated ColdFusion variables (e.g. #myVariable#).
My varsData.cfm contains this code:
<cfset msg = "hello world!">
<cfoutput> &output=#msg#& </cfoutput>
My Flash has nothing but a large dynamic text box (named "results_txt") with a standard component button (named "load_btn"). The ActionScript reads:
// create a new LoadVars instance
thisVars = new LoadVars();
// load the variables when the button is clicked
load_btn.onRelease = function() {
// send thisVars to "varsData.cfm", put results in thisVars
thisVars.sendAndLoad("varsData.cfm", thisVars);
} // end onRelease function()
// swonking function
thisVars.onLoad = function(success) { // check if vars all loaded
if (success) { // vars completely loaded
trace("success");
formatText();
} else { // The data didn’t load at all. Display error
trace("error: data didn't load");
} // end "if (success)" statament
} // end swonking function
// set the text
function formatText() {
_root.results_txt.text = thisVars.output;
} // end formatText()
// stop the movie
stop();
When I test the movie and click the button, I get "#msg#" rather than "hello world!" displayed in the textfield. I obviously need #msg# to be evaluated to "hello world!". Can anyone shed some light on why this is happening and how I am to fix the problem?
Pax et bonum,
retrotron
PS. Someone told me this issue corrected by Macromedia is the solution: http://www.macromedia.com/support/flash/ts/documents/load_xdomain.htm. However, I am developing and testing all on a local machine, so it shouldn't have a problem with cross-domain interaction. Also, I don't think I understand the instructions at said site very well, they are too ambiguous for me.