Flash播放器将停止动画的时候了视区 [英] Flash Player stops animating when out of viewport

查看:200
本文介绍了Flash播放器将停止动画的时候了视区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站的几个闪光的电影。他们通过一个动画它持续约15秒(但这不是一成不变的)全部循环。他们都开始在同一时间玩,并保持同步。

I have several flash movies on a site. They all loop through an animation which lasts for approximately 15 seconds (but this is not set in stone). They all begin to play at the same time and are in sync.

然而,当我调整浏览器窗口,或滚动页面,如果一个Flash Player的实例不是在视口中,它将停止播放。当它返回到视口,将恢复并随后不与其它Flash Player实例同步。

However, when I resize the browser window, or scroll the page, if a flash player instance is not in the viewport, it stops playing. When it returns to the viewport, it resumes and subsequently is out of sync with the other flash player instances.

我在IM pression这是一个Flash播放器的优化。反正是有禁止这种行为,可能通过JS / AS3?这似乎是发生在Firefox和Chrome在Windows上。

I am under the impression this is a flash player optimisation. Is there anyway of disabling this behaviour, possibly through JS / AS3? It appears to happen in Firefox and Chrome on Windows.

更新

我只想澄清。我在使用本地连接和ExternalInterface的同步的广告到位的方法。我所寻找的是一个方法来停用的优化的FlashPlayer的导致帧速率正在急剧减少。

Just to clarify. I have methodologies in place using local connection and ExternalInterface to sync the ads. What I am looking for is a method to disable the "optimisation" of FlashPlayer which results in the frame rate being drastically reduced.

推荐答案

您不能禁用此功能。它的落实到位,降低了内存和CPU的使用时,闪光灯的应用程序是不可见的。

You can't disable this feature. It's put in place to lower the memory and CPU use when the flash application isn't visible.

什么的的为您提供的虽然是一种叫做油门API。这是创建允许Flash应用程序创作者的能力的专用API来精确地通知的的它们的应用将要减慢/节流。

What is available for you though is something called the Throttle API. This is a dedicated API created to allow creators of Flash applications the ability to be notified exactly when their application is going to be slowed down/throttled.

下面是一个例子。

addEventListener(ThrottleEvent.THROTTLE, onThrottleEventHandler);

function onThrottleEventHandler(e:ThrottleEvent):void
{
    if(e.state == ThrottleType.THROTTLE)
    {
        /**
         * the player is about to be slowed down to a frame rate
         * set in e.targetFrameRate
         */
    }
    else if(e.state == ThrottleType.PAUSE)
    {
        /**
         * the player is going to be paused completely, AKA 0 fps
         */
    }
    else if(e.state == ThrottleType.RESUME)
    {
        /**
         * the player is now back to normal as it has resumed
         * from the paused or throttled state
         */
    }
}

现在你可以计算出最适合您最好的方式,但我的建议是,以存储已经过去了,每当被节流,或通过暂停当前时间:

Now you can figure out a way that works best for you but my suggestion is to store the current time that has passed whenever being throttled or paused via:

currentTime = getTimer();

然后计算多少时间已经过去,一旦你的应用程序使用又说:

Then calculate how much time has passed once your application has resumed using:

passedTime = getTimer() - currentTime;

然后,你想用这些信息是什么。

Then do what you like with this information.

我希望这有助于,你应该提供一个更大程度的控制,现在你已经熟悉了油门API。有关它的更多信息,请点击此处在文档中:<一href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/ThrottleEvent.html"相对=nofollow> ThrottleEvent

Hopefully this has helped, should offer you a greater degree of control now that you're familiar with the Throttle API. For more information on it, check it out in the documentation here: ThrottleEvent

这篇关于Flash播放器将停止动画的时候了视区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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