sendAndLoad problems

  • Gamercjm
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 01, 2005
  • Posts: 34
  • Loc: Murrietta, CA
  • Status: Offline

Post March 11th, 2006, 3:59 pm

Ok, so I have everything working so far exept the sendAndLoad, It works fine if i just do a send() using POST but i want it to sendAndLoad().

Code: [ Select ]
var myData = new LoadVars();
submit.onPress = function(){
    if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
        myData.id = _root.id;
        myData.to_phone = _root.to_phone;
        myData.to_name = _root.to_name;
        myData.sendAndLoad("test.php",myData,"POST");
    }
}
    
myData = new LoadVars()
myData.onLoad = function(){   
    if(this.writing=="Ok") {
        status.text = "Submited data was saved"
        gotoAndStop(42);
    } else status.text = "Error in saving submitted data";
}
stop();
  1. var myData = new LoadVars();
  2. submit.onPress = function(){
  3.     if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
  4.         myData.id = _root.id;
  5.         myData.to_phone = _root.to_phone;
  6.         myData.to_name = _root.to_name;
  7.         myData.sendAndLoad("test.php",myData,"POST");
  8.     }
  9. }
  10.     
  11. myData = new LoadVars()
  12. myData.onLoad = function(){   
  13.     if(this.writing=="Ok") {
  14.         status.text = "Submited data was saved"
  15.         gotoAndStop(42);
  16.     } else status.text = "Error in saving submitted data";
  17. }
  18. stop();


When i have it as send() it will just pop-up a new window that POST's the information. But i cant seem to get it to use sendAndLoad then go to the from 42.

PHP:

Code: [ Select ]
<?php
$cell = $_POST['to_phone'];
if( $cell != "") {
echo "writing=Ok&";
}
?>
  1. <?php
  2. $cell = $_POST['to_phone'];
  3. if( $cell != "") {
  4. echo "writing=Ok&";
  5. }
  6. ?>


Is the PHP file setup correctly to work with Flash?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 11th, 2006, 3:59 pm

  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post March 11th, 2006, 11:30 pm

i think its better that U use 2 loadVars .

Code: [ Select ]
var SendBuffer = new LoadVars();
var RcvBuffer = new LoadVars();
  1. var SendBuffer = new LoadVars();
  2. var RcvBuffer = new LoadVars();


then

Code: [ Select ]

submit.onPress = function(){
  if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
   SendBuffer.id = _root.id;
   SendBuffer.to_phone = _root.to_phone;
   SendBuffer.to_name = _root.to_name;
   SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST"); // USE RcvBuffer.
  1. submit.onPress = function(){
  2.   if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
  3.    SendBuffer.id = _root.id;
  4.    SendBuffer.to_phone = _root.to_phone;
  5.    SendBuffer.to_name = _root.to_name;
  6.    SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST"); // USE RcvBuffer.


then for received buffer .

Code: [ Select ]

RcvBuffer.onLoad = function(){    
  if(this.writing=="Ok") {
   status.text = "Submited data was saved"
   gotoAndStop(42);
  } else status.text = "Error in saving submitted data";
}
stop();
  1. RcvBuffer.onLoad = function(){    
  2.   if(this.writing=="Ok") {
  3.    status.text = "Submited data was saved"
  4.    gotoAndStop(42);
  5.   } else status.text = "Error in saving submitted data";
  6. }
  7. stop();


hope that helps

m0o
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • Gamercjm
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 01, 2005
  • Posts: 34
  • Loc: Murrietta, CA
  • Status: Offline

Post March 12th, 2006, 12:44 am

Hmm nope, still doesnt seem to be posting.

Does it matter if i have it sendAndLoad("http://....
like on another server, or should it still be working?
  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post March 12th, 2006, 1:19 am

if you have the PHP script within the same directory of the swf file then it should be okay , otherwise u gotta specify the path .

try removing POST in

Code: [ Select ]
SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST");


instead keep it this way

Code: [ Select ]
SendBuffer.sendAndLoad("test.php",RcvBuffer);


make sure of the objects paths you are using check for namin mistakes etc ...
for now try the above .

tell me exactly what happens !
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • Gamercjm
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 01, 2005
  • Posts: 34
  • Loc: Murrietta, CA
  • Status: Offline

Post March 12th, 2006, 9:37 am

Ugghh im gonna die.
Nope that didnt work either, I tried that but just like before once i click the button nothing happens. Im sure the .php file works for sure because i did just a regular <form> in html and that went through.

Is there any other possible way to send information to .php using POST or GET that will be hidden from the user(like not redirecting or opening a new window) and also continue playing the flash? I need it to in the middle of the flash send the information.

Timeline:
Movie...........................................................sendAndLoad.............endMovie
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 2nd, 2006, 8:10 am

hi,

I'm having a similar problem, did you managed to find a solution?

tnx
  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post May 2nd, 2006, 8:45 am

well guys check if your php script works first =\ ..
don't know where the error is , do u guys have the files ?
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 2nd, 2006, 8:53 am

well, the script works fine as long as I'm using firefox or netscape. My problems apear when I'm using IE :(
The script is in perl, not php but I don't think this is an issue here.
Tnx
  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post May 2nd, 2006, 9:06 am

are u sure its not a typo in flash ?
check your vars check the posts above ...
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 2nd, 2006, 9:11 am

how can it be a typo if everything works in firefox or netscape?
i think i'm missing something.
the url, and the inputs are the same for FF of IE but still only in FF the inputs get to the server.
  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post May 2nd, 2006, 9:15 am

thought u r doing it from flash ..
typo in flash instance name or a variable u might have missed ..
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 2nd, 2006, 10:25 am

the form is in flash, but this is the problem, the same swf works if it is loaded in FF pr neatscape, but fails if it is loaded by Internet Explorer...
:(
  • classified
  • Expert
  • Expert
  • User avatar
  • Joined: Dec 23, 2005
  • Posts: 540
  • Loc: Bahrain
  • Status: Offline

Post May 2nd, 2006, 12:18 pm

i hear ya which ie u using 6 ? 7 ? and which ver of flash ? 8 ?
m0o , where <<Less is More>>
http://www.zainals.com
http://www.zainals.com/blog
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 3rd, 2006, 1:13 am

I'm using (i'm not shure, right now I'm at work) IE 6 and Flash mx 2004(so this should be flash 8 ).
I have to tell you that i'm not very familiar with flash and it is possible to make stupid mistakes. evenso, right now i'm quite shure this is not the case... the action script is quite simple and as I said, it works fine if I use FF or netscape.
  • bogeangles
  • Newbie
  • Newbie
  • No Avatar
  • Joined: May 02, 2006
  • Posts: 8
  • Status: Offline

Post May 3rd, 2006, 1:35 am

let me describe my problem in more detail:
i have to "make it work" a page that sends an email from a flash form.
i have a form with a few fields and I use a perl script to send the mail.
my biggest problem is that I don't have access to the perl script or at the logs of the server where this site is located, so I don't realy have the posibility to debug.
I had problems using some of the available functions like loadvars.send, loadvars.sendAndLoad, loadVariablesNum or loadVariables. Using any of this functions didn't get my anywhere(it doesn't work with any browser). The only way to make the post action was using getURL(url, _blank, "post").
the perl script have to recive 3 required inputs recipient="the_email_address", subject="subject_of_the_email" and required="". All other inputs from the form will be included in the email.
I was hopeing that I was overlooking some basic stuff but now I'm not shure about that.
tnx for your time and I hope you can help me :)
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 3rd, 2006, 1:35 am

Post Information

  • Total Posts in this topic: 25 posts
  • Users browsing this forum: No registered users and 46 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
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.