2013-04-14 52 views
0

我需要创建一个与AS3的电子邮件表格。来自AS2我的知识是有限的。在舞台上,我有一个提交按钮,一个组合框和两个用于电子邮件和密码的textinput字段。阅读一些教程,我知道如何将变量电子邮件和密码发送到MySQL数据库。我的问题是,我用一些数据填充了一个组合框。我怎样才能将这段数据发送到我的数据库? 我向你展示我的代码,看看对不起它相当长,但如果你可以帮助那很棒!As3电子邮件形式与组件

//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); 
    } 

回答

0

你应该尝试AMFPHP。它非常适合填补Flash和PHP之间的差距。

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

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

帮助了我很多,在过去