AS3预加载器悲伤,无法从库加载符号
我创建了一个 AS3 预加载器,并将其代码放置在第一帧上。
然后我制作了一个符号,并将其放入库中。它被设置为在第 1 帧上不导出,并且 fla 的设置在第 2 帧上导出所有类。直到第二帧才出现对该对象的引用。
然后,每当我在没有选中“在第一帧中导出”框的情况下进行编译时,闪存就会崩溃。
为了解决这个问题,一位朋友建议我在第 3 帧上开始游戏逻辑,这样它将正确加载第 2 帧。这似乎工作正常,该类正在正确实例化。
然后,事实证明它没有加载影片剪辑,只是实例化了该类。同样,这个问题可以通过在第 1 帧中导出来解决,但我真的负担不起这样做。
这位朋友建议我在第 3 帧的舞台上放置一个符号实例,并在第 4 帧上执行游戏逻辑。他们说这将正确初始化影片剪辑。
然而,事实并非如此。如何加载整个符号、图形等,而不导出到第 1 帧?这个单个符号可能包含 10-20 MB 的图形,因此需要预加载。
感谢您的帮助!
编辑:长话短说,我所需要的只是某种方式来加载影片剪辑,以便它可以使用和可见以及一切。
编辑:有没有办法通过 AS3 强制加载影片剪辑?
I created an AS3 preloader, and placed the code for that on frame one.
I then made a symbol, and placed it in the library. It was set to NOT export on frame 1, and the fla's settings had all classes exported on frame two. There were no references to the object until frame two.
Then, flash crashed whenever I compiled without the "Export in frame one" box checked.
To fix this, a friend suggested I start my game logic on frame 3, so it will have properly loaded frame 2. That seemed to work fine, the class was instantiating properly.
Then, it turned out that it was not loading the movieclip, only instantiating the class. Again, this could be fixed by exporting in frame 1, but I really cannot afford to do that.
The same friend suggested I place an instance of the symbol on the stage on frame 3, and perform game logic on frame 4. They said this would initialize the movieclip properly.
However, this was not the case. How can I load the entire symbol, graphics and all, without exporting to frame 1? This single symbol will contain probably 10-20 MB of graphics, so it needs to be preloaded.
Thanks for the help!
EDIT: To make a long story short, all I need is some way to load a movieclip so it can be used and visible and everything.
EDIT: Is there any way to force-load a movieclip via AS3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从描述中很难弄清楚。
如果您制作新的 .fla 文件,请将大(10-20MB)剪辑粘贴到第 2 帧上,
将导出帧设置为 2,然后尝试从帧 1 预加载并访问帧 2 中的大剪辑内容,您是否遇到相同的错误?
都有此内容
假设您在第 1 帧和第 2 帧中
:应该没问题,否则,如果跟踪大剪辑返回 null,您可能需要尝试使舞台无效:
在第 2 帧上:
基本上我的建议是:
哈特哈,
乔治
Hard to figure out from descriptions.
If you make a new .fla file, paste your large(10-20MB) clip on frame 2,
set your export frame as 2, then try to preload from frame 1 and access the large clip's content in frame 2, do you get the same error ?
say you have this in frame 1:
and in frame 2:
It should be ok, otherwise, in case tracing your large clip returns null, you might want to try to invalidate the stage:
on frame 2:
Basically what I'm suggesting is:
HTH,
George