我正处于创建自己的在线多人问答游戏的最初阶段,我正在做 this tutorial当我在与第一帧和动态文本字段关联的 ActionScript 中遇到编译错误(在标题中)时:
onClipEvent (load) {
loadVariables("http://localhost/read.php?file=testfile", this, "GET");
}
我不确定我做错了什么?使用 Flash CS5...此代码是否与 CS3 不兼容?任何帮助将不胜感激,我一直试图找出我做错了一个小时! :)
谢谢!
最佳答案
您的主要问题是您正在编写 Actionscript 2,而您的项目很可能设置为 Actionscript 3。onClipEvent
是 Actionscript 1 的旧遗产,因此,该教程充其量已过时。
您的加载代码(在 AS3 中)应该看起来更像这样:
var loader:URLLoader = new URLLoader();
// specify format as being variables
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, handleLoadComplete);
// load your data
loader.load(new URLRequest("foo.php"));
function handleLoadComplete (e):void {
trace(loader.data is URLVariables); // true
trace(loader.data.valueFromYourData);
}
关于php - ActionScript 错误 - 1086 : expecting a semicolon before left curly brace?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5831025/