Flash:自定义Loader在鼠标移动时闪烁
免责声明:我是 ActionScript 3 的新手。
我有一个 Main 类(它扩展了 Sprite),它将我的 Loader 添加为子类。加载器处理来自服务器的连续图像流(想想 MJPEG)。我创建一个套接字,添加一个 ProgressEvent.SOCKET_DATA 侦听器,并将数据放入本地缓冲区。如果我有一个完整的帧,那么我对其调用 loadBytes(),然后返回等待下一个数据块到达。
这非常有效。但是,如果更新图像时鼠标移动,则控件会轻微闪烁。但如果没有接收到帧,则不会出现闪烁。我需要对图像进行双缓冲吗?如果是这样,我应该在哪里执行此操作?装载机似乎不是正确的地方。
Disclaimer: I'm new to ActionScript 3.
I have a Main class (which extends Sprite) that adds my Loader as a child. The Loader processes a continuous stream of images from a server (think MJPEG). I create a socket, add a ProgressEvent.SOCKET_DATA listener, and put the data into a local buffer. If I have a complete frame, then I call loadBytes() on it, and go back to waiting for the next chunk of data to arrive.
This works very well. However, if the mouse is moving when the image is being updated, then the control flickers slightly. But if no frames are being received, then there is no flickering. Do I need to double-buffer the image? If so, where do I do this? The Loader doesn't seem like the right place.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅上面的评论:
see comment above:
仅此一点是行不通的。
我一直在寻找似乎几个小时的时间,通过浏览 Loader 的文档找到了答案。
您需要这个:
这可以加快渲染速度并且闪烁消失。
That alone does not work.
I have been hunting for what seems like hours and I found the answer by browsing the documentation for Loader.
You need this:
This speeds up rendering and the flashing goes away.