简体   繁体   English

将AS2 SWF加载到AS3 SWF时出现问题

[英]Problem Loading AS2 swf into AS3 swf

I've been trying very hard to get an AS2 swf to load properly inside an AS3 swf - but to no avail ... 我一直在努力使AS2 SWF正确加载到AS3 SWF中-但无济于事...

The AS2 file (which is a rather big app referencing many external xml files etc.) works perfectly when launched in Flash Player. 在Flash Player中启动时,AS2文件(这是一个很大的应用程序,引用了许多外部xml文件等)。

When trying to load the same file through an AS3 swf (using URLRequest and Loader classes), the file starts loading but stops abruptly during the preloading phase. 当尝试通过AS3 SWF(使用URLRequest和Loader类)加载同一文件时,该文件开始加载,但在预加载阶段突然停止。 (Same happens if I try to load it using AS2 "loadMovie".) (如果我尝试使用AS2“ loadMovie”加载它,也会发生同样的情况。)

Update: It seems as if the swf actually loads through AS2 loadMovie but not AS3 Loader class. 更新:似乎瑞士法郎实际上是通过AS2 loadMovie加载的,而不是通过AS3 Loader类加载的。

What is there more to try? 还有什么可以尝试的? Security settings, custom loader classes - any advice is appreciated. 安全设置,自定义加载程序类-任何建议,不胜感激。

Also keep in mind that an AS2 swf loaded into an AS3 swf will have problems communicating to it's parent swf, so the Loader will have trouble keeping track of the loading of the swf - so that might cause you a problem. 另外请记住,加载到AS3 SWF中的AS2 SWF将无法与其父SWF通信,因此,加载程序将无法跟踪SWF的加载,因此可能会引起问题。 You should build the swf that DOES the loading in AS2 and then connect it to an AS3 swf using LocalConnection. 您应该构建在AS2中执行加载的SWF文件,然后使用LocalConnection将其连接到AS3 SWF文件。

In general your loaded movie have to be designed to be loaded from an other swf. 通常,必须将加载的电影设计为从其他SWF文件加载。 For example any initialization code must be places after the Event.ADDED_TO_STAGE event occurs and every references to the root don't work as you expect. 例如,任何初始化代码都必须位于Event.ADDED_TO_STAGE事件发生之后,并且对根的所有引用均无法按您期望的那样工作。 For example the root for an element it's the stage when the swf runs alone but when the swf it's loaded from another swf the root it's the parent swf that can be different in size and position causing you some trouble. 例如,元素的根是单独运行swf的阶段,但是当swf从另一个swf加载时,根是父swf,其大小和位置可能会有所不同,这会给您带来麻烦。

In your AS2 code, be sure to set lockroot (or was it _lockroot?) to true. 在您的AS2代码中,请确保将lockroot(或者是_lockroot?)设置为true。 Also if you use _level0 in your AS2 code anywhere, it will not work, you need to change that to _root. 另外,如果您在任何地方的AS2代码中都使用_level0,它将无法正常工作,您需要将其更改为_root。

check this one. 检查这一。

  1. make an AS2 container to load your AS2 APP, in frame2; 在frame2中制作一个AS2容器以加载您的AS2 APP;
  2. load container to AS3 animation. 将容器加载到AS3动画。
  3. make these communications via LocalConnection. 通过LocalConnection进行这些通信。

or 要么

export all your AS2 APP classes to frame 2 (in publish setting). 将所有AS2 APP类导出到第2帧(在发布设置中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM