note 51715 added to ref.ming

From: Date: Fri, 08 Apr 2005 09:23:26 +0000
Subject: note 51715 added to ref.ming
Groups: php.notes 
Request: Send a blank email to php-notes+get-87695@lists.php.net to get a copy of this message
/* If you are looking to do some simple interaction between Flash MX and php, here is an extremely basic model to get you started. The Flash file has a simple Input Text field which allows the user to enter text (ie a textbox). The flash then passes the textfield to the php script for processing/database interaction etc. The idea is a form made in Flash, but processing by php/mysql (or whatever). If you want to handle all GUI in Flash, see the links below for more info. All "Actions" or "Action Script" located in frame 1, layer 1. In Flash, create an Input Box with an instance name of myTextBox. Create a "submit button" using Insert>New Symbol>Movie Clip. Dont use the PushButton Component or you will have to add scripting to that component (ie outside Frame1 Layer1). Keeping all the Action Script in Frame1 makes for a simpler example. Next, click on the background in Frame1 (the "Properties" dialog should show the Background color). Hit F9 to show actions for Frame1. Enter the below code: */ //Create object to hold vars dataSender = new LoadVars(); //Define submit button behavior submit_button.onRelease = function() { //assign properties to LoadVars object created previously //myTextBox is instance name for input text box //foo will be the var passed to php (ie $foo) //Set foo to the text entered by user dataSender.foo = myTextBox.text; //Call flash's send function to send foo to the php script //Using "_self" will pass control to the php script dataSender.send("testFlash.php", "_self", "POST"); } /* Put the swf file in an html file and upload it to the server Create the below php file and save it as testFlash.php: <?php echo "foo= $foo"; ?> Push testFlash.php to the same directory on the server and hit your html file with your browser. Parts of this code taken from: http://www.thegoldenmean.com/technique/flashMX_mailform1.html and http://actionscript-toolbox.com/samplemx_php.php */ ---- Manual Page -- http://www.php.net/manual/en/ref.ming.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51715 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51715&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51715&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51715&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51715&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51715&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51715&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87695) next »