|
-
Getting PHP to pass commands to AS...
My website has a PHP script that sends an email. I am using Koolmoves 5.2.5 to design the site.
The email PHP script works fine thanks to a couple of guys from Flashkit, and a friend or two around the world that helped me out! Thanks guys!
However, I want to take the script a step further. When PHP has finished sending the email using the mail function, I want it to pass a command back to ActionScript to tell it to play a success/failure movie.
I know that the PHP mail function returns true/false, indicating the success of the function. Also, in a tutorial written by Jeffrey F. Hill, the print language construct was used to pass the result back to AS in the following fashion:
Code:
Print "_root.Mail.EmailStatus=Complete - Your mail has been sent";
Is it possible to get Print to do something like:
Code:
Print "_root.mcEmail.gotoAndPlay("emailSent")"
I know I'm taking a big chance here, so I wouldn't be surprised if this won't work. If so, can anyone tell me the best way to get the confirmation video playing.
Thanks all!!!
-
KoolMoves Moderator
yes this works I use this type of thing in my email form.
How are you sending the mail values to Php? If usinf loadvariables have the php echo the result in urlencode variable form like
$ok=mail(.....);
echo "mailSuccess=".ok;
then in your AS the variable mailSuccess with recieve this value.
The only problem with this method is that it will not wait for the value so you have to write your AS to wait untill this variable is set before going to the success page.
-
I'm using $_POST to send variables to the PHP script. All is well in that, and I am also able to send some values back this way...so says the PHP documentation.
I just need to know if I can for example call an ActionScript function such as : gotoAndPlay("messageSuccesfullySent") directly from PHP?
Anycase, I am trying a loop now which continuously plays a "Sending in progress" animation. This loop is watching a variable called sendingInProgress, and the moment it turns to "NO", it skips to the next bit which checks the sendSuccess variable.
This is all a nip 'n tuck operation I'm doing here. I don't know PHP, and I'm programming on what I'm reading up in between this forum and the PHP documentation. So your help is highly appreciated!
-
My last 2 lines of code look like this:
Code:
&success = mail($to, $subject, $message, $headers);
Print "&strSuccess=$success&strSending=N";
-
Senior Member
Looks like you are on the right lines....
As a debug move I usually make a small dynamic textbox(es) with the variable name of the varables you are hoping for back from the php...handy to see whats happening.....no loop needed for that as the values will change as soon as a reply occurs.....
You could try your php using a html (or even the address of the php and a log query string) form to see what is echoed back also...(ps if you use firefox then the reply would be found in windows temp/plugin temp)
Have fun
mike
mike
-
Got it working okay...Sort of. It's a bit unstable at present, but I'll soon have things smoothed out...
...hopefully!
-
KoolMoves Moderator
You migh want to read up on loadVars as it has events for onData and onLoad that way it's easy to check when data has come back
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|