加载外部PNG图像成加载到AS3的swf包装的AS2瑞士法郎 [英] Loading external pngs into an AS2 swf that is loaded into an AS3 swf wrapper

查看:213
本文介绍了加载外部PNG图像成加载到AS3的swf包装的AS2瑞士法郎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包装的SWF加载了一系列的AS2电影。每一个AS2电影加载了一系列.png文件的。

I have a Wrapper SWF that loads a series of AS2 movies. Each AS2 movie loads a series of .png files.

AS3_wrapper.swf
 |-> AS2_1.swf
      |-> image_1.png
      |-> image_2.png
 |-> AS2_2.swf
      |-> image_1.png
      |-> image_2.png

在AS2我听的PNG图像的使用负载器onLoadInit 并更新我的UI。对

Inside of the AS2 I listen for the load of the pngs using onLoadInit and update my UI.

这工作得很好,第AS2瑞士法郎。但是,当我打开第二AS2瑞士法郎器onLoadInit 不触发的PNG图像。我的猜测是,图像缓存或类似的东西。我把一个随机字符串的请求结束,以尽量避免高速缓存,但似乎并没有工作。

This works fine for the first AS2 swf. But when I load the second AS2 swf the onLoadInit isn't triggered for the pngs. My guess is that the images are in a cache or something like that. I put a random string on the end of the request to try and avoid the cache but that doesn't seem to work.

在code在AS2看起来大致是这样的:

The code in the as2 looks roughly like this:

var flagLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadInit = Delegate.create(this, handleImageLoad);
flagLoader.addListener(listener);
var row:MovieClip = frame1["row" + (numLoaded + 1)];
flagLoader.loadClip(predictionData[numLoaded].flag + "?r="+Math.random(), row.flag);

我并确保在同一时间只加载一张图片(我读过的轶事证据装载超过一件事的时间混淆的MovieClipLoader )。对于第一个AS2文件一切都很正常。当我打开第二个AS2文件中的 handleImageLoad 永远不会被调用。

I'm making sure to load only one image at a time (I've read anecdotal evidence loading more than one thing at a time can confuse the MovieClipLoader). For the first as2 file everything works great. When I load the second as2 file the handleImageLoad never gets called.

更新:更令人费解的是,如果我重装了第一个AS2影片(第二AS2电影无法加载图像之后)的第一个AS2电影加载图像再细

Update: Even more perplexing is if I reload the first AS2 movie (after the second AS2 movie fails to load the images) the first AS2 movie loads the images again fine.

更新2:在尝试从使用的MovieClipLoader轮询改变(因为是有益建议)我已经发现了一些更多的证据是相关

Update 2: After trying to change from using a MovieClipLoader to polling (as was helpfully suggested) I have found some more evidence that is relevant.

当我打开第一个AS2文件,并从顶层追查夹它打印出 _root 。加载时第二AS2文件跟踪同一 _root 。这导致我检查,如果他们发生冲突的名字,他们是。两者有一个孩子叫。第一个,当我跟踪它出来为 _root.frame 预期。第二AS2文件的痕迹 _level0.instance3.instance118.instance111.frame 。我猜这是涉及到这个问题。

When I load the first AS2 files and trace from the top level clip it prints out _root. The second AS2 file when loaded traces the same _root. This lead me to check if they were clashing on names and they are. Both have a child called frame. The first one, when I trace it comes out as _root.frame as expected. The second AS2 file traces _level0.instance3.instance118.instance111.frame. I'm guessing this is related to the problem.

闪存是保持两个文件相同的_root,但它正在改变他们的孩子的位置(随后加载的文件具有相同名称的孩子)。因此,无论在onLoad会到错误的片段或它装载的事件。

Flash is keeping the _root of the two files the same but it is changing the locations of their children (for subsequently loaded files that have children with the same names). So either the onLoad is going to the wrong clip or the events about it loading are.

推荐答案

在每3 - 4年里,我遇到一个问题,我认为将最终打破了我......

Once every 3-4 years I come across a problem that I think will finally break me...

我想弄清楚,为什么即使我已成功加载我的AVM1影片到AVM2的电影文件,则AVM1文件没有按预期运行时,遇到了这个帖子。

I came across this post when trying to figure out why even though I was successfully loading my AVM1 movie into an AVM2 movie file, the AVM1 file was not running as expected.

已经解决不能AS2之间通信的初始巨大的问题 - AS3文件,我简直不敢相信,当AVM1电影似乎总是开始播放后不久停止

Having solved the initial huge issue of not being able to communicate between AS2 - AS3 files I couldn't believe it when the AVM1 movie always seemed to halt shortly after starting playback.

对于我来说,向MovieClipLoader loadClip()方法没有发射任何进展或完成的事件,这是因此引起我的文件完全停止播放,因为你们两个建议。

For me, the MovieClipLoader loadClip() methods were not firing any progress or completed events which was consequently causing my file to stop playback completely, as you both suggested.

您的建议,运行时间间隔之后loadClip调用比较加载到字节总字节数为我工作。

Your suggestion to run an interval after the loadClip call to compare bytes loaded to bytes total worked for me.

谢谢谢谢谢谢谢谢谢谢! :D

Thank you Thank you Thank you Thank you Thank you ! :D

这篇关于加载外部PNG图像成加载到AS3的swf包装的AS2瑞士法郎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆