【发布时间】:2017-01-26 04:43:37
【问题描述】:
我试图在 as3 的主类中生成一个链接到主类的预加载器类,但现在我的主类在编译时不断出错。
我不知道为什么会发生这种情况,因为代码之前可以运行。 如果有帮助,我的 ide 是 flashdevelop 5.2.0.3(我尝试从 5.1.1.1 更新)
在我尝试编译之前,我最初得到“错误:null”,构建因错误(fcsh)而停止。然后在尝试再次编译时我得到 “错误:类不能嵌套。”
我尝试按照类似问题的建议清理项目,但没有成功解决这个问题。
任何帮助将不胜感激。
(跳过导入语句和包)
[Frame(factoryClass="Preloader")]
public class Main extends Sprite {
private var adventure_model:AdventureModel;
private var title_view:TitleView;
private var title_controller:TitleController;
protected var panelCollection:PanelCollection = null;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
panelCollection = new PanelCollection();
adventure_model = new AdventureModel();
title_controller = new TitleController(adventure_model, panelCollection);
title_view = new TitleView(adventure_model, title_controller, "title_view", 0, 0, panelCollection);
addChild(title_view);
}
}
【问题讨论】:
-
最近我遇到了同样的错误,背后没有明确的原因。在我的情况下,挖掘和跳舞揭示了一个实际的原因。我使用 SecureSWF 以 SWC 形式保护一些安全例程,并将 Array 替换为 Vector. 数据类型。
-
谢谢!我能够在一个完全不同的类中找到有问题的代码。
-
@LambantDelphian 如果你已经解决了你的问题,那么你应该发布这个问题的答案 - 即使它是最小的......只是为了让人们不认为这仍然是一个悬而未决的问题。
标签: actionscript-3 flashdevelop