So I am attempting to set up a form in flash that communicates with a database. I followed the instructions on a tutorial (http://www.developphp.com/Flash_tuto...ial.php?tid=39), and got the sample to communicate with our database. That shows me that my php script is working correctly, but when I copy the sample into my flash file, the flash no longer talks with the database.
I copied the form fields into a new layer, and copied the action script exactly. Here is the action script:
// Btn listener
submit_btn.addEventListener(MouseEvent.CLICK, btnDown);
// Btn Down function
function btnDown(event:MouseEvent):void {
// Assign a variable name for our URLVariables object
var variables:URLVariables = new URLVariables();
// Build the varSend variable
// Be sure you place the proper location reference to your PHP config file here
var varSend:URLRequest = new URLRequest("http://www.auraseattle.com/config_flash2.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;
// Build the varLoader variable
var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);
variables.first_name = uname_txt.text;
variables.last_name = uname2_txt.text;
variables.email = uname3_txt.text;
variables.phone_number = uname4_txt.text;
variables.birthday = uname5_txt.text;
variables.sendRequest = "parse";
// Send the data to the php file
varLoader.load(varSend);
// When the data comes back from PHP we display it here
function completeHandler(event:Event):void{
var phpVar1 = event.target.data.var1;
var phpVar2 = event.target.data.var2;
result1_txt.text = phpVar1;
result2_txt.text = phpVar2;
}
}
I am trying to figure out what might be the difference between the two flash files? The sample only has one frame, while mine has multiple frames and actions. Do I need to do something else to make the button work when clicked? I haven't set any on (release) { code yet.
Let me know what other information I should provide. Thanks in advance!



Reply With Quote


Bookmarks