Php 如何将此代码转换为ActionScript 3.0?
我被这段代码难住了——似乎每次我移植这段AS2代码的一些保留字(它所做的是使用Flash和PHP发送邮件),我都会出错Php 如何将此代码转换为ActionScript 3.0?,php,actionscript-3,flash-cs4,Php,Actionscript 3,Flash Cs4,我被这段代码难住了——似乎每次我移植这段AS2代码的一些保留字(它所做的是使用Flash和PHP发送邮件),我都会出错 stop(); var senderLoad:LoadVars = new LoadVars(); var receiveLoad:LoadVars = new LoadVars(); sender.onRelease = function() { senderLoad.theName = theName.text; senderLoad.theEmail
stop();
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.theMessage = theMessage.text;
senderLoad.sendAndLoad("http://leebrimelow.com/mailExample/send.php",receiveLoad);
}
receiveLoad.onLoad = function() {
if(this.sentOk) {
_root.gotoAndStop("success");
}
else {
_root.gotoAndStop("failed");
}
}
Any idea how?
我不是AS2方面的专家,但我可以帮助您了解此代码所需的AS3语法 试着看一看会对你有帮助吗 这是AS3概念的基础 这就是AS3函数语法
bldg1_thumb1.addEventListener(MouseEvent.CLICK, MyFunction);
function MyFunction (event:MouseEvent):void{
gotoAndStop ("2");
}
如果将LoadVars对象更新为As3,只需使用如下代码所示的UrlLoader对象
var mainLoader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("http://domain/mailExample/send.php");
var variables:URLVariables = new URLVariables();
variables.theName = theName.text;
variables.theEmail = theEmail.text;
variables.theMessage = theMessage.text;
request.method = URLRequestMethod.POST;
request.data = variables;
mainloader.addEventListener(Event.COMPLETE, handleComplete);
mainLoader.load(request);
private function handleComplete(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
}
那么,你是说这只是我需要更改的代码的一部分,而其他代码保持不变?