As3电子邮件用组件形成php

时间:2013-04-14 14:50:28

标签: php forms actionscript-3 flash combobox

我需要使用AS3创建一个电子邮件表单。来自AS2,我的知识有限。在舞台上,我有一个提交按钮,一个组合框,以及两个用于电子邮件和密码的textinput字段。阅读一些教程,我知道如何将变量电子邮件和密码发送到mysql数据库。我的问题是,我已经用一些数据填充了一个组合框。如何将该数据发送到我的数据库? 我告诉你我的代码,看到对不起,但是如果你可以帮助那么好!

//Building the variables
var phpVars:URLVariables = new URLVariables();

//Requesting the php file
var phpFileRequest:URLRequest = new URLRequest("php.file");
phpFileRequest.method = URLRequestMethod.POST;

 phpFileRequest.data = phpVars;

 //Building the loader
 var phpLoader:URLLoader = new URLLoader();

 phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

 //Variables ready for the processing
 phpVars.email = email.text;
 phpVars.password = password.text;

btn_one.addEventListener(MouseEvent.CLICK, btnHandler);

 //Validate form fields
 function btnHandler(event:MouseEvent):void{
    statusTxt.text =  "" + event.target.data.systemResult;
    trace(event.target.data.systemResult);

}

    var statusTxt:TextField = new TextField();
    statusTxt.x = 160.00;
    statusTxt.y = 9.80;
    statusTxt.width = 241.95;
    statusTxt.height = 22.75;
    statusTxt.text = "Please fill out the form below";
    addChild(statusTxt);

    //Wanting to add this combobox to my db
       var persons:Array = new Array();
    persons[0] = "Male";
    persons[1] = "Female";

   combo_box.dataProvider = new DataProvider(persons);
   combo_box.addEventListener(Event.CHANGE, dataHandler);

   function dataHandler(e:Event):void{
      trace(e.target.value);
  }

1 个答案:

答案 0 :(得分:0)

你应该试试AmfPHP。它非常适合填补flash和PHP之间的空白。

您可以在php中编写服务,并使用servicebrowser进行调试。 一旦php端工作,你可以做as3部分。

http://www.silexlabs.org/amfphp/

过去帮了我很多次

相关问题