View Full Version : sendAndLoad within another movieclip?
emedia
06-10-2005, 03:27 AM
Hi there,
I have a flash>asp.net form working great in it's own movie clip when published, but when I load it into another clip it stops calling the aspx script..
let's call them form.swf and main.swf
is there some pathing issues to be aware of when bringing it into another clip?
I have declared all my variables on the main timeline of the form swf and they are showing up as I would like them to in a variables check (ctrl alt v) on the main.swf when loaded in and submitted. as well as that all my validation is still working and is only locally declared also...
here's some code from the form.swf
if (formValid == "true") {
send_lv.sendAndLoad("http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx", reply_lv, "POST");
reply_lv.onLoad = loadedDotNetVars;
testvar="waiting_still"
}
function loadedDotNetVars(success){
if(success) {
testvar = reply_lv.isuccess
gotoAndPlay("counter");
}
}
CyanBlue
06-10-2005, 02:46 PM
Howdy and Welcome... :)
Maybe you should manually specify what variables you want to send to your ASPX page like this...
send_lv.someVariable1 = _root.somepath.somevar1;
send_lv.someVariable2 = _root.somepath.somevar2;
send_lv.sendAndLoad("http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx", reply_lv, "POST");
emedia
06-14-2005, 02:08 AM
thanks for the reply CyanBlue, I do have my variables specified like that above the code I posted so I'm not sure what else to do..
I have put a getURL in the code to see what variables are going out and I'm getting this string:
"http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx?testvar=waiting&validateEmail=%5Btype+Function%5D&clientID=4&formValid=true&gender=male&reply%5Flv=&send%5Flv=password%3Dxcxx%26gender%3Dmale%26intere st%3Dxxxc%26age%3D33%26email%3Dmatt%2540emediacamp aigns%252Einfo%26lastname%3Dmatt%2540emediacampaig ns%252Einfo%26firstname%3Dmatt%2540emediacampaigns %252Einfo"
seems it's putting some gibberish in there? how can I avoid this...because my values are in there too....
emedia
06-14-2005, 03:22 AM
small update:
I've gotten around the gibberish by declaring the variables twice, as a value of the text field then just on their own to 'clean them up'...but is this really nescessary just to get them to display right?
firstname = firstname_txt.text;
lastname = lastname_txt.text;
email = email_txt.text;
age = age_txt.text;
interest = interest_txt.text;
password = password_txt.text;
send_lv.firstname = firstname;
send_lv.lastname = lastname;
send_lv.email = email;
send_lv.age = age_txt.text;
send_lv.interest = interest;
send_lv.gender = gender;
send_lv.password = password;
this now works fine when run inside another movie with getURL, (get or post) but alas, not with sendAndLoad. grrr.
any ideas? :(
CyanBlue
06-14-2005, 03:51 AM
What do you mean by 'gibberish'??? Can you show me???
emedia
06-14-2005, 03:56 AM
I was referring to this:
"http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx?testvar=waiting&validateEmail=%5Btype+Function%5D&clientID=4&formValid=true&gender=male&reply%5Flv=&send%5Flv=password%3Dxcxx%26gender%3Dmale%26intere st%3Dxxxc%26age%3D33%26email%3Dmatt%2540emediacamp aigns%252Einfo%26lastname%3Dmatt%2540emediacampaig ns%252Einfo%26firstname%3Dmatt%2540emediacampaigns %252Einfo"
the "%25" etc it was putting in the variables, seems I have that sorted now, but as I said in my last post sendAndLoad just won't pass these to my .aspx
CyanBlue
06-14-2005, 02:15 PM
There is nothing wrong with that... %25 or %26 being the escape string that Flash is sending out to the ASPX page in a long query string format... That's the way it is and there should be nothing wrong with that...
The problem might be that you are sending out additional stuff to the ASPX page which is making the ASPX script confused...
Can you post the full script rather than the snippets??? :)
emedia
06-15-2005, 04:21 AM
stop();
//initialise variables
clientID=4;
formValid = "true";
gender = ""
//create a validation function for all req fields
function validateEmail () {
if (email_txt.text.indexOf("@") < 1) {
formValid = "false";
}
if (email_txt.text.lastIndexOf(".") <= (email.text.indexOf("@") + 2)) {
formValid = "false";
}
if(firstname_txt.text==""){
formValid = "false";
}
if(lastname_txt.text==""){
formValid = "false";
}
if(email_txt.text==""){
formValid = "false";
}
if(age_txt.text==""){
formValid = "false";
}
}
reply_lv = new LoadVars();
send_lv = new LoadVars();
submit.onRelease = function () {
validReport.gotoAndStop(1);
formValid = "true";
validateEmail();
//grab values of text fields
firstname = firstname_txt.text;
lastname = lastname_txt.text;
email = email_txt.text;
age = age_txt.text;
interest = interest_txt.text;
password = password_txt.text;
//pass values to send_lv
send_lv.firstname = firstname;
send_lv.lastname = lastname;
send_lv.email = email;
send_lv.age = age_txt.text;
send_lv.interest = interest;
send_lv.gender = gender;
send_lv.password = password;
if (formValid == "false") {
validReport.gotoAndStop(2);
testvar="waiting_invalid"
}
if (formValid == "true") {
//next line is just for testing getURL
//getURL("http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx", "_blank", "POST");
send_lv.sendAndLoad("http://www.emcpay.com/sarahmcleod/addInactiveUserSP.aspx", reply_lv, "POST");
reply_lv.onLoad = loadedDotNetVars;
testvar="waiting_still"
}
function loadedDotNetVars(success){
if(success) {
testvar="waiting_success"
testvar = reply_lv.isuccess
gotoAndPlay("counter");
}
}
}
this will work in it's own swf, when the swf is loaded into another it does not work. (it makes it to the 'waiting_still' line however)
when the swf is loaded into another and I use getURL as opposed to send and load it also works.
perhaps it's due to the pathing of my reply_LV?
CyanBlue
06-15-2005, 02:26 PM
Howdy... :)
You don't really need this part... You can have that but that's not really necessary...
//grab values of text fields
firstname = firstname_txt.text;
lastname = lastname_txt.text;
email = email_txt.text;
age = age_txt.text;
interest = interest_txt.text;
password = password_txt.text;
But you might want to make sure that you are getting the correct value with those textField instance names...
Create a textField on the stage and give it an instance name of 'test_txt'... and add this line right below that block to see if it is displaying the correct data...
test_txt.text = password_txt.text
If you don't see the text, you have some problem with the path... If not, we'll have to investigate further... :)
emedia
06-16-2005, 12:43 AM
I had to add those lines to get my variables to go in the string correctly, otherwise the extra charactrs were being inserted in my send_LV and '=' symbols among others were being removed. after I added that I could see it had cleaned up my querystring in getURL considerably. not sure why, but it seems to like getting a .text value more than just a declared variable on the timeline.
in regards to the pathing, I have a textbox on my stage that is showing up the values correctly, I know these values are getting through ok because I can also see them being submitted to the database when I use the getURL instead of sendAndLoad, it's coming through just how I like it. my problem is it won't do this with sendAndLoad. (except in it's own swf)
CyanBlue
06-16-2005, 08:54 PM
Hm... It sounds like you've got to post some sample files that I can fiddle with it... ;)
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.