View Full Version : sending data stored in movieclip from flash to asp
advika
12-01-2005, 07:08 AM
I have problem in sending data stored in movieclip to asp.
I know how to send data from flash to asp using loadVariablesNum.
on (release) {
loadVariablesNum("http://localhost/xyz/xyz.asp",0, "POST");
}
when i execute this, it works fine, it sends all the variables which are at _level 0 to asp file.
and in asp i can read them using
Request.Form("pname") // this works fine.
But when i am storing same pname variable in a movie clip with instance name "varTarget" and executing following code in flash .
on (release) {
loadVariables("http://localhost/xyz/xyz.asp","_root.varTarget","POST");
}
i could not get the value of pname in asp.
Request.Form("pname") // this is not working.
How to retrieve the data in asp when we recieve variables stored in movieclip.
If anyone have suggestions regarding this please help me.
thankyou for your time and consideration.
Regards
Advika
declare pname as a _root variable or _global variable from that movieclip, it should work.
advika
12-01-2005, 07:30 AM
Thanks cota,
I know if i give _root.pname it will work.
even now also variables in _root are posted to the asp file, which i don't want.
I don't want to post the data in _root, It should send only the data which is in the specified movieclip,
Which version of flash are you using? If using MX or higher, consider using LoadVars, gives you more control over situations like this.
advika
12-01-2005, 07:38 AM
I am using FlashMx2004,
I tried what you said even than i could not get the value of pname in asp.
on(release) {
lv = new LoadVars();
lv.send("http://localhost/xyz/xyz.asp","_root.varTarget", "POST");
}
thanks cota
regards
advika
LoadVars should look something like this
myVars = new LoadVars();
on(release) {
myVars.SomeVariableName = VariableInMC;
//collect your variables in this manner
myVars.send("http://localhost/xyz/xyz.asp");
}
You're basically adding myVars.Variablenames to collect all the variables and build this LoadVars() object, easy to control, nice to use.
advika
12-01-2005, 12:06 PM
Thanks cota,
I tried as you said, It is sending to asp , the problem is how to retrieve in asp.
on(release) {
myVars = new LoadVars();
myVars.pname = _root.varTarget.pname;//collect your variables in this manner
myVars.speed = _root.varTarget.speed;
myVars.send("http://localhost/xyz/xyz.asp");
}
When it calls asp file how to get these data.
Request.Form("pname")
when i use this , i am getting null value.
regards
rekha
Lets trace the values in flash, see where its breaking. Also, just an odd quark, myVars = New LoadVars() should be outside of the onRelease handler
myVars = new LoadVars();
on(release) {
myVars.pname = _root.varTarget.pname;
myVars.speed = _root.varTarget.speed;
trace(myVars.pname);
myVars.send("http://localhost/xyz/xyz.asp");
}
Tell me what pname outputs when you run it.
advika
12-02-2005, 04:08 AM
cota you are not following me,
I have to trace the value in asp not in flash.
If we trace the value in flash , it works, but how to get in asp.
when i send data from flash to asp , in asp file i am retrieving with general for loop like this.
For each objItem in Request.Form
Response.write "status=" & Request.Form(objItem)
Next
The above loop will read all the values in the form object,
this is working when i am sending data using
loadVariablesNum("http://localhost/xyz/xyz.asp",0, "POST");
but the problem is , the root level has other data , my for loop is receiving all the data in root level.
if my form object should contain only specified values not all which are in root level, for this reason i used a separate movieclip so that i can send specified data to asp,
Now how to retrieve that data in asp , i.e data sent from a movie clip
thanks for your time and consideration
regards
advika
Just, Request("pname"), etc etc....
advika
12-02-2005, 09:20 AM
Hi cota,
sorry, I don't want to retrive using variable name,
Request("pname") // this works
as i said , i want to use generalized for loop.
for example:
For each objItem in Request.Form
Response.write Request.Form(objItem)
Next
if i use this, i am getting null values.
Any time if i have to send more no. of variables also my asp file should work.
thanks :)
regards
advika
Maybe its a POST vs GET issues, humor me here, try using Request.QueryString instead of Request.Form...
advika
12-28-2005, 06:28 AM
Hi Cota,
I am back, Actually i went on vacation so i could not reply you back,
I think you didnot understand my problem.
you said
request("pname") can be used to retrieve in asp.
but i want to use following loop
For each objItem in Request.Form
Response.write Request.Form(objItem)
Next
in future i may send more var's , that i don't want to change asp file only i can change in flash.
myVars.pname = _root.varTarget.pname;//collect your variables in this manner
flash
myVars = new LoadVars();
myVars .onLoad = function(success) {
if(success){
trace("added");
}
}
myVars.pname = _root.varTarget.pname;
myVars.xpos = _root.varTarget.ypos;
myVars.sendAndLoad("http://localhost/xespace/playerstatus.asp",myVars,"POST");
in asp when i am running following loop.
For each objItem in Request.Form
Response.write Request.Form(objItem)
// code to add the above object in xml file.
Next
it is adding : pname, xpos, and onLoad variable values into xml.
if you want i will send my asp file. to you
regards
advika
Wish you a very Happy New Year !!! in Advance :)
try this:
mySender = new LoadVars();
myReciever=new LoadVars();
myReciever.onLoad = function(success) {
if(success){
trace("added");
}
}
mySender .pname = _root.varTarget.pname;
mySender .xpos = _root.varTarget.ypos;
mySender .sendAndLoad("http://localhost/xespace/playerstatus.asp",myReciever,"POST");
see if that gets rid of the onLoad method being sent... it may not, but since it is not defined now, it may work for you.
advika
12-29-2005, 09:03 AM
Hi tg,
thanks a lot, :)
it is working fine now.
earlier i tried similar way what you have suggested, it was not working , since i made a small mistake.
mySender .sendAndLoad("http://localhost/xespace/playerstatus.asp",myReciever,"POST");
instead of this i was using following statement.
myReciever.sendAndLoad("http://localhost/xespace/playerstatus.asp",mySender ,"POST");
thats why it was not working for me.
once again thanks,
regards
Advika
Wish you a very Happy New Year !! in advance.
rosemary
06-04-2008, 12:49 PM
Can I have the fla file as I am a newbie I am unable to do myself
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.