Another bug: LoadVariables?
Monday, June 27th, 2005I’ve got headache, please help! Two weeks ago I’ve got problem with POSTing data in IE, now it seems is problem of Flash. I guess everybody use LoadVariables, me too, and all was ok, but now I needed to use it in preloaded movies, and it seems it does not works correctly when is it called from preloaded movie. When I call it from single swf, it works. When I preload this swf, and then call LoadVariables, there is no result. I’ve tested it on local, on sameDomain, another domain, text file from hardisk, none was working. On server in Apache logs, i’ve found out, that page was not called, so it seems, it is problem, that LoadVariables is not called from Flash.
Has someone similar problem? Does anyone know solution or workaround for this? I can’t move whole funcionality to preloader, you have to agree with me
Please let me know, maybe I’m wrong with something. You can download sources for testing.
tagged under:




14 Comments
ethan
• Visit Site
June 27th, 2005
loadVariables second parameter is the target path to a movieclip that will recieve the vars. Did you compensate for the fact that the loaded movie is now inside another movieclip?
from flash help:
loadVariables (url:String , target:Object [, variables:String]) : Void
Parameters
url An absolute or relative URL where the variables are located. If the SWF file issuing this call is running in a web browser, url must be in the same domain as the SWF file; for details, see the Description section.
target The target path to a movie clip that receives the loaded variables.
variables An optional parameter specifying an HTTP method for sending variables. The parameter must be the string GET or POST. If there are no variables to be sent, omit this parameter. The GET method appends the variables to the end of the URL and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for long strings of variables.
Administrator
• Visit Site
June 27th, 2005
but loadVariables is still in same swf as onData, i dont move funcionality from swf, where it works before, just add preloader. (you can see it in sources, there are FLA as well)
Administrator
• Visit Site
June 27th, 2005
small mistake (do not switch from “Flash 6 , AS1.0″ to “Flash7, AS2″) found maybe solution, that it is problem of _lockroot. when I have comment _lockroot = true in 2nd movie (where is LoadVariables) all seems to work (maybe instead of _root.debugText use trace, or you have to correct _root there)
Alejandro
• Visit Site
June 27th, 2005
Not a bug.
_lockroot only works when pusblishing to Flash player 7, your sources are publishing to player 6. If you switch to publish to 7 your code should work. If you need to publish to player 6 just remove the refrence to _root when you call your debugText function in the line:
for(var i in this) _root.debugText(’key: ‘ + i + ‘, value: ‘ + this[i]);
Make it:
for(var i in this) debugText(’key: ‘ + i + ‘, value: ‘ + this[i]);
Cheers,
Alejandro
Administrator
• Visit Site
June 27th, 2005
i know, but it’s not working in 7, i know, it was problem, but with Hans Wichman on Flashcoders mailinglist we’ve found out, that when in preloader.swf is included AdminTools component it works, in other case it deosnt work
something is weird
but do not know what!
Alejandro
• Visit Site
June 27th, 2005
If you will be using Flash Player 7 then I would avoid the onData handler, the LoadVars object and handlers are a lot more reliable. I just tried it with your sources and it works. The onData handler will work in your original source, however, if you load the test.swf movie into a level using loadMovieNum instead of into an mc using loadMovie.
Administrator
• Visit Site
June 28th, 2005
Thanks Alejandro, with LoadVars it works even with _lockroot = true
André
• Visit Site
July 26th, 2005
I have the same problem and I´have passed very though hours in finding the solucion. I am VERY happy with the communication above. I am not alone… But…
Is there a simple way to rewrite the
loadVariables(_root.URLroot+”asp/GetGrupoData.asp”, “_root.ASP_DATARECEIVER”) to the one that should work? The LoadVars Class. I am realy tiered of all that testing…..
André
• Visit Site
July 26th, 2005
At least
var my_lv = new LoadVars();
my_lv.sendAndLoad(_root.URLroot+”asp/GetGrupoData.asp”, “_root.ASP_DATARECEIVER”);
does NOT work.
Administrator
• Visit Site
July 26th, 2005
and where it doesnt work, everywhere, ir just in some type of browser? because in my case it was special only in IE in frameset
but LoadVars work for me
André
• Visit Site
July 26th, 2005
The web http://www.dyrarcan.com, which I made, works fine. I use loadVariables to get data out of my database.
Now I need to use a pre-loader. With loadVariables it does not work. I use IE (without frames). The web is shown but it does not receive the data out of the database anymore.
André
• Visit Site
July 26th, 2005
At least the LoadVars substitucion is now working okay.
I had to use also a LoadVars object to receive the data. In this example the receiver (a LoadVars object ) is result_lv.
var send_lv:LoadVars = new LoadVars();
send_lv.sendAndLoad(_root.URLroot+”asp/GetGrupoData.asp”, result_lv, “POST”);
BUT…. it does not work when I load the SWF in a pre-loader.
dranath
• Visit Site
August 8th, 2007
just use:
myData = new LoadVars();
myData.onLoad = function() {
myText_txt.html=true;
myText_txt.htmlText = this.VariableName;
};
myData.load(”myText.txt”);
mark
• Visit Site
August 21st, 2007
dranath , Thank you
i been trying to get LoadVariables to work now for two days now
I was going crazy with it , but your example code worked great.. and easy to do.
Live Preview
Leave a comment