avmovie
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions.
本文介绍了一种解决方案,当它们具有不同的SWF版本时,可以将一部电影重新加载到另一部电影中。
Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share. I developed a flash site in AS3.0 but due to some constraints I had to use the home page of another Flash movie developed in AS2.0; so basically I was loading a AVMovie1 movie into another AVMovie2 movie.
有时,当我遇到一个我想分享的有趣事实时,我正在从事一个ActionScript项目。 我在AS3.0中开发了一个Flash网站,但由于某些限制,我不得不使用在AS2.0中开发的另一部Flash电影的主页。 所以基本上我是将AVMovie1电影加载到另一AVMovie2电影中。
I had a Tween created in my which worked well on first load within AVMovie2. But the problem started when I navigated to another section and again returned to Home. This time, surprisingly, none of the Tweens in worked! I checked multiple times to be sure that when I navigated, I cleared my home loader which I added to the base flash movie.
我在中创建了一个Tween,在第一次加载AVMovie2时效果很好。 但是,当我导航到另一部分并再次返回到Home时,问题开始了。 令人惊讶的是,这次,中的所有Tweens都没有工作! 我进行了多次检查,以确保在导航时,我清除了添加到基本Flash电影中的家庭装载机。
After much debugging, I changed my Tween class to use GreenSock AS2.0 version in home swf. Still the same thing happened; individually the home ran absolutely fine, but when called through the base movie, all the tweens ran perfect only for the first time.
经过大量调试后,我将Tween类更改为在家庭swf中使用GreenSock AS2.0版本。 还是同样的事情发生了。 每个房屋的运行情况都非常好,但是当通过基本电影调用时,所有补间仅是第一次运行完美。
I actually wasted my whole day at it but was lucky enough to get to a solution at the end of the day.
我实际上一整天都在浪费时间,但是很幸运在一天结束时能找到解决方案。
I came to know that when an AS2/AS1-based swf is subloaded into an AS3-based one, then unloaded, and another one is loaded subsequently, a bug in the Flash Player prevents the onEnterFrame from working properly and the _root reference becomes invalid.
我知道, 当将基于AS2 / AS1的swf子加载到基于AS3的swf中,然后卸载,然后再加载另一个时, Flash Player中的错误会阻止onEnterFrame正常工作,并且_root引用无效 。
The source of my knowledge was from the code comments provided in TweenLite class.
我的知识来源来自TweenLite类中提供的代码注释。
The code which did the trick was to add this line:
达到目的的代码是添加以下行:
(_root) ;
Please note: I used this._lockroot() in the also.
请注意:我也在 中使用了this._lockroot() 。
I hope this will help someone to avoid wasting time in such scenario.
我希望这可以帮助某人避免在这种情况下浪费时间。
This article was originally published on my blog.
本文最初发表在我的博客上 。
翻译自: /articles/4198/
avmovie