• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

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


Izlude    104

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
    $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...?


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...

Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.