首先,我不了解课程,如何“调用”或“启动”它们。我是阶级无知。
我有两个 .fla 文件。我的 .fla 文件之一包含 15+ 个 .as 文件;我们称它为一个 XML 编辑器。另一个 .fla 文件由 10+ 个 .as 文件组成;我们称它为接口。
xmleditor.swf 加载 interface.swf。在 xmleditor.swf 中,将出现一个登录屏幕,最终用户以“用户”或“管理员”身份登录。“user”或“admin”存储在名为“userType”的公共变量中。userType 变量是在名为 Login.as 的众多 xmleditor.fla .as 文件之一中创建的。
登录后,xmleditor 会加载 interface.swf。interface.fla 使用 10+ .as 文件。一个叫做 nodeNames。因为我需要在 nodeNames 中使用 if 语句。因为它是这样的:
if (Login.userType == "user"){
trace("do something");
}
我有以下 FlashVars.as 文件,但我不知道要使其工作的步骤是什么。
package extras.utils {
import flash.display.Sprite;
import flash.display.LoaderInfo;
/* In AS3, we need to have a display object on the stage to access FlashVars
* this class can be used once, and then referenced from anywhere as
* FlashVars.data.variableName
*/
public class FlashVars extends Sprite {
public static var data:Object;
public function FlashVars() { }
public function load():void { //Only needs to be called once
data = this.root.loaderInfo.parameters;
}
}
}
我应该使用这个 FlashVars 吗?如果是这样,如何?
或者有没有更简单的方法来访问变量?