avmovie_AVMovie1和AVMovie2

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 home.swf 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 home.swf 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.

我在home.swf中创建了一个Tween,在第一次加载AVMovie2时效果很好。 但是,当我导航到另一部分并再次返回到Home时,问题开始了。 令人惊讶的是,这次,home.swf中的所有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:

达到目的的代码是添加以下行:

TweenLite.jumpStart(_root) ;

Please note: I used this._lockroot() in the home.swf also.

请注意:我也在 home.swf中使用了this._lockroot()

I hope this will help someone to avoid wasting time in such scenario.

我希望这可以帮助某人避免在这种情况下浪费时间。

This article was originally published on my blog.

本文最初发表在我的博客上

翻译自: https://www.experts-exchange.com/articles/4198/AVMovie1-and-AVMovie2.html

avmovie

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值