Re: Flash Variables to ASP
To send variables from flash to a page (asp, php, .... it works like that), it must pass through the LoadVars object. This sends the data just like a simple html form would do.
Code:
var my_lv:LoadVars = new LoadVars();
my_lv.v1= myvariable1;
my_lv.v2 = myvariable1;
For sending data, you have the choice between open and send the result page directly (using send)
Code:
// send (can be POST or GET)
// here, sending POST and open the page in a new window
my_lv.send("mypage.asp", "_blank", "POST" );
Re: Flash Variables to ASP
OK thank you, for it seems to work. But, once in my asp file how do I get my my_lv.v1 and my_lv.v2?
In php I managed to recover a $_POST ['myvar'], but in asp I don't know how to do.
I searched a lot and I get the code but its still not working:
in Flash:
HTML Code:
var my_lv:LoadVars = new LoadVars();
my_lv.v1= "myvariable";
my_lv.send("myasp.asp","_blank","POST" );
in the ASP:
HTML Code:
<%
Dim thename
thename = Request.Form("v1" )
response.write(thename)
%>
I manage well on my asp page but I can not display the variable that I passed.
Re: Flash Variables to ASP
Quote:
Originally Posted by
CodGuru
For sending data, you have the choice between open and send the result page directly (using send)
Code:
// send (can be POST or GET)
// here, sending POST and open the page in a new window
my_lv.send("mypage.asp", "_blank", "POST" );
or send and retrieve the result page in a variable actionscript (sendAndLoad)
Code:
// results in result_lv
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
// function called when the data sent by the asp page is LOADED
if (success) {
// data received
} else {
// in case of failure
}
};
// send POST
my_lv.sendAndLoad("mypage.asp", result_lv, "POST" );
I hope this answers your question