从浏览器调整 Flash 对象的大小而不闪烁 [英] Resize flash object from the browser without flickering

查看:34
本文介绍了从浏览器调整 Flash 对象的大小而不闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何实现 TheFWA (thefwa.com) 已经做得很好的原生滚动条效果(我不喜欢 Flex 滚动条).

I was wondering how to achieve the native scrollbar effect which TheFWA (thefwa.com) has managed to do pretty well (I am not a fan of Flex scrollbars).

我找到了这篇文章(http://stackoverflow.com/questions/318675/how-can-i-create-a-flex-application-with-dynamic-height),并在我调用时实现了该技术当 flash 对象改变大小时,每次都会通过 ExternalInterface 调用一个 JS 函数.这个 JS 函数只是调整保存 flash 对象的 div 的大小,从而创建原生条.

I found this post (http://stackoverflow.com/questions/318675/how-can-i-create-a-flex-application-with-dynamic-height), and implemented the technique, as I am calling a JS function through ExternalInterface every time, when the flash object changes size. This JS function simply resizes the div which holds the flash object, which creates the native bars.

不幸的是,当我非常迅速地调整大小时(例如,从 800 到 1800 的高度),闪光对象只是扭曲了几毫秒(好像它没有改变它的大小,但只是被拉到了各个方向).几毫秒后,一切恢复正常,但整个情况在视觉上真的很烦人.

Unfortunately, when I resize quite rapidly (from 800 to 1800 height, for instance) the flash object simply gets warped for several milliseconds (as if it hasn't changed its size, but simply got pulled in all directions). After these milliseconds, things get back to normal, but the whole situation is really visually annoying.

本来以为只是时间问题,但是尝试了一堆设置延迟后,效果是一样的……只是延迟了.

Originally I thought that it's simply a timing issue, but after a bunch of attempts to set a delay, the effect was the same ... just delayed.

我该如何解决?我知道这在技术上是可行的.看看TheFWA,看看flash和浏览器如何顺畅地相互通信,使原生滚动条正常工作,没有任何闪烁或误测

How can I resolve that? I know it's technically possible. Just take a look at TheFWA, and see how smoothly flash and the browser are communicating with each other to make the native scroll bars work, without any flickering, or mismeasurement

推荐答案

这是自 Flash Player 10 以来出现的问题,直到 FP 11 测试版仍在发生.

This is an issue that appeared since Flash Player 10 and is still happening up to FP 11 beta.

当您调整包含 SWF 的 DIV 的大小时,SWF 本身也会调整大小,因此您要求"播放器重绘内容.但问题是这次重绘会造成这种丑陋的闪烁.

When you resize the DIV that contains the SWF, the SWF itself is resized, therefore you "ask" the player to redraw the content. But the thing is that this redraw creates this ugly flicker.

解决方法是根本不调整 SWF DIV 的大小并调整另一个空 DIV 的大小,因此您强制浏览器更新滚动条.

The workaround it to not resize the SWF DIV at all and to resize another empty DIV, so you force the browser to update the scrollbar.

此时,当您使用滚动条时,它不会移动 SWF DIV(因为它通常是一个位置绝对全尺寸 Flash 站点),但随后您创建了一个简单的 JS 回调来将滚动值发送到您的应用程序.

At this point when you use the scrollbar it won't move the SWF DIV (as it is probably often a position absolute full-size flash site) but then you create a simple JS callback to send the scroll values to your application.

听起来可能要付出更大的努力,但实际上并没有多少,最终您将创建一种更灵活的方式来管理您的应用程序.

It may sound as a much greater effort but it is not much actually, and at the end you will create a more flexible way to manage your application.

您可以在此处查看使用情况http://www.andrefelipe.com/

You can check that in use here http://www.andrefelipe.com/

源代码在我的框架 https://github.com/andrefelipe/fabricaframework/blob/master/src/fabrica/external/Browser.as

这篇关于从浏览器调整 Flash 对象的大小而不闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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