在文档类中使用其类时的奇怪实例行为
我将尝试尽可能清楚地描述该问题:
- 文档类 (Main.as) 加载 SWF 文件并将其放置在舞台上。
- SWF 的舞台上已经有一个子实例,并且具有自己定义的类 (Child.as)。
- 如果我在文档类 (Main.as) 中导入 SWF 子级的类 (Child.as),其唯一目的是访问静态属性,那么舞台上的子级实例会变得疯狂(即循环运行),而不会抛出任何异常编译或运行时的错误或警告。
注意:单独导入子类不会执行任何操作(可能是因为它因未使用而被丢弃),但实际上在公共文档类中的任何位置提及该类都会触发舞台上子实例的奇怪行为。
只是为了让自己清楚,只要我不在文档类中以任何方式使用它的类,子实例就可以正常工作,没有任何问题。
我的问题:即使没有错误或警告消息,您是否知道什么会使舞台上的子实例表现得好像发生了错误一样?或者可能的解决方法?
I'm going to try to describe the issue as clear as possible:
- The document class (Main.as) loads a SWF file and places it on the stage.
- The SWF already has a child instance on its stage with a defined class of its own (Child.as).
- If I import the SWF child's class (Child.as) in the document class (Main.as) with the sole purpose of accessing a static property, then the child's instance on the stage goes crazy (i.e. runs in a loop) without throwing any error or warning at compilation or run-time.
Note: The import of the child class alone doesn't do anything (probably because it is discarded for not being used), but actually mentioning the class anywhere in the public document class triggers the weird behavior of the child instance on the stage.
Just to make myself clear, the child instance works just fine, without any problems as long as I do not use its class in any way in the document class.
My question: Do you have any idea what would make the child instance on the stage behave as if an error occurred even if there's no error or warning messages? Or a possible workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试不导入类并使其通过(加载 swf 后)
我同意,这不是一个很好的答案,而是一种解决方法。如果有人找到这个问题的真正答案,我会很高兴。
Try not importing the class and getting it through (once the swf is loaded)
I agree, it is not a very nice answer but a work-around. I'd be glad if someone found a real answer to this question.