• 0

Adobe Animate - help me make a button that calls a php function using jQuery


Question

I'm gonna give the folks at Adobe forum a break šŸ˜› I've been hounding them for half a year now, with GREAT success.. however when I asked my last question, it seems to have tired them out. Your turn Neowin! BTW this is literally the LAST thing that needs to be fixed. Any help appreciated.

OK Here it is... This is a canvas project. All I need to do is have my button call on the following php fileĀ as shown below:
(the file is calledĀ  SendEcard php)Ā Ā (note that I didn't put my real url in the example, i'm not ready to go public)

<? 
register_globals( 'NGPCFRES' );

$CreateEcard = date(U); 
$filename = $CreateEcard.".txt"; 
$ToEmail = $_POST["ToEmail"]; 
$FromEmail = $_POST["FromEmail"]; 
$ToName = $_POST["ToName"]; 
$FromName = $_POST["FromName"]; 
$Greeting = $_POST["Greeting"]; 
$IntroMessage = $_POST["IntroMessage"]; 
$EndMessage = $_POST["EndMessage"]; 
$EcardSelect = $_POST["selected"]; 
$Today = (date ("l dS of F Y ( h:i:s A )",time())); 
$Created = "Ecard Created on $Today"; 
$EcardNum = $_POST['EcardSelect'];
$EcardText = "ToName={$_POST['ToName']}&ToEmail={$_POST['ToEmail']}&FromName={$_POST['FromName']}&FromEmail={$_POST['FromEmail']}&Greeting={$_POST['Greeting']}&IntroMessage={$_POST['IntroMessage']}&Created={$_POST['Created']}&"; 
$fp = fopen( "dBText/$filename","w"); 
fwrite($fp, $EcardText, 10000); 
fclose( $fp ); 
######Email Card######## 
## You can change the subject and the message part around. 
## Make sure to change the Link as stated in the Tutorial. 
## (Change from 'someSite' to your actual site - leave the rest the same 
$ToSubject = "E-card from $FromName"; 
$Message = "$ToName,\nYou have recieved a Flash E-card from $FromName. \nClick the following link to view your card:\n\n http://www.MYSITE.net/SelectCard.php?EcardText=$CreateEcard&ENum=$EcardNum\n\n-----------------------------------\nHere is the message that was sent:\n$ToName,\n$Greeting\n$IntroMessage\n\n-$FromName\n\n\n-----------------------------------\nThis card was sent by Bunny and Panda\n\nMaking you smile a little more each time."; 

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">"); 

## This next line returns a success message to the movie. 
print "_root.holder.Status=\n Copy the following link to view your card:\n http://www.MYSITE.net/SelectCard.php?EcardText=$CreateEcard%26ENum=$EcardNum\n"; 

function register_global_array( $sg ) {
    Static $superGlobals    = array(
        'e' => '_ENV'       ,
        'g' => '_GET'       ,
        'p' => '_POST'      ,
        'c' => '_COOKIE'    ,
        'r' => '_REQUEST'   ,
        's' => '_SERVER'    ,
        'f' => '_FILES'     ,
        'n' => '_SESSION'
    );
    Global ${$superGlobals[$sg]};
    foreach( ${$superGlobals[$sg]} as $key => $val ) {
        $GLOBALS[$key]  = $val;
    }
}
function register_globals( $order = 'gpc' ) {
    $_SERVER;       //See Note Below
    $_ENV;
    $_REQUEST;
    $order  = str_split( strtolower( $order ) );
    array_map( 'register_global_array' , $order );
}
?>

Ā 

In flash, all this php file did was read the values of my input text fields and print them to an e-mail and also generate a randomly numbered txt file which the e-card later reads the values and prints to its own dynamic text fields.

Ā 

In Canvas, this is obviously going to be much different. I don't even know where to begin... should the above php beĀ creating a jsĀ file instead of txt? And would the e-card simply load this jsĀ file as an external script and run it so that the jsĀ can tell the e-card's dynamic text what to display? Sounds about right, but again...I don't know how to do this :(


The php file itself does have a few.. quirks..Ā that probably need to be changed to work with the canvas (js).Ā The lineĀ print "_root holder Status= etc....Ā  I guess has to be changed to:

window.parent.this.holder.Status.text = "etc... stuff";

(This is only a wild guess, maybe someone out there knows)... the Status is a dynamic text field that exists in an iframe called iframe0, hope that helps with the confusion of me using window.parent...?

Ā 

FINALLY...
In flash, for input text fields, using the above php code works fine, hence the current:Ā 

Ā $ToEmail = $_POST["ToEmail"];


In canvas, I have to refer to input text component as:Ā $('#FromName'), so does that mean the above php has to change to reflect this? (if so, what's the correct change I should use in my php?
And that's my question x)Ā  See how simple a function can be asked in such a complicated manner by a noob? šŸ˜¢Ā yeah the demise of Flash really really hurt me...

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

This topic was automatically locked because it did not receive any replies for a year. If you want to have this topic reopened

  • please contact any staff moderator or
  • report the first post of the topic with the reason why it should be reopened.

Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.