2013-04-14 50 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/

幫助了我很多,在過去