sendAndLoad problems.

  • cougarsy
  • Born
  • Born
  • cougarsy
  • Posts: 1

Post 3+ Months Ago


I have developed an online test with 5 sections. Each section is one scene in the Flash movie. I am using Flash 8. At the end of each section there is a button the user presses to go to the next section. The action in the button is:

on (release) {
myData2.sendAndLoad("Newprocesstest.asp", myData2, "POST");
myData2Test.sendAndLoad("GradeTest.asp", myData2Test, "POST");

The first sendAndLoad is executing fine. But, the second one (Gradetest.asp) either doesn't execute at all (in all 5 sections) or it executes inconsistently--ie for one user it executed for sections 1 and 2, but not for the other 3 sections. I don't understand why this is working so inconsistently and only seems to be executing sometimes.

I have verified the asp file is working correctly as I can run it from a browser manually.

Any ideas would be much appreciated!
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1825
  • Loc: In the Great White North

Post 3+ Months Ago

I think you need to post more of your code. Do all 5 buttons have the same code? Do you create a holder to return content into? Do you test if the variable has been loaded etc?

I assume your problem comes from overwriting the myData2 and myData2Test because your telling the sendAndLoad to add its return data back to the same object. Try sending those to a separate object.

for example

Code: [ Select ]
contentSend_lv:LoadVars = new LoadVars();
contentReturn_lv:LoadVars = new LoadVars();

contentSend_lv.someContent = myTextbox.text; // give the object content to send
someButton.onRelease = function(){
contentSend_lv.sendAndLoad("somescript.asp", contentReturn_lv, "POST");
  1. contentSend_lv:LoadVars = new LoadVars();
  2. contentReturn_lv:LoadVars = new LoadVars();
  3. contentSend_lv.someContent = myTextbox.text; // give the object content to send
  4. someButton.onRelease = function(){
  5. contentSend_lv.sendAndLoad("somescript.asp", contentReturn_lv, "POST");
  6. }

Its also possible that you are going to the next section too soon before the send/receive has completed. Remember that this action doesn't execute as quickly as the actionscript on the page instead it has to connect to your script, execute the script and then wait for something to return.

I recommendu using the onLoad callback to find out if the data load was successful and only then should you go on to the next section.

Code: [ Select ]
contentReturn_lv.onLoad = function(success:Boolean) {
    if (success) { // list content is passed back
       trace("sendandload successful");
       // do some action like goto another frame
    } else { // server error
       trace("server error");
  1. contentReturn_lv.onLoad = function(success:Boolean) {
  2.     if (success) { // list content is passed back
  3.        trace("sendandload successful");
  4.        // do some action like goto another frame
  5.     } else { // server error
  6.        trace("server error");
  7.     }
  8. };

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.