2

我正在将 actionscript 3 项目转换为 AS2,因为 AS3 在 CryEngine 3 中尚不兼容 scaleform。

我在图书馆里有一个 MovieClip。在 ActionScript 链接下,我设置了“Export for Actionscript”和“Export in frame 1”,标识符为“Notification”,而“Class”中没有任何内容。

此代码导致错误The class or interface 'Notification' could not be loaded.

var newMovieClip:MovieClip = new Notification();
stage.addChild(newMovieClip);

这段代码有什么问题?创建一个 MovieClip 并将其添加到舞台似乎是一个简单的操作,但它似乎无法正常工作。

4

1 回答 1

0

In ActionScript 2 you need to use the attachMovie method (see docs). Your code would look something like this:

var newMovieClip:MovieClip = this.attachMovie("Notification", "newMovieClip", this.getNextHighestDepth());

Note that there's no addChild method in ActionScript 2; the displayList was added in ActionScript 3.

于 2013-05-20T00:04:22.660 回答