开发者

Flash: custom Loader flickers when mouse moves

Disclaimer: I'm new to ActionScript 3.

I have a Main class (which extends Sprite) that 开发者_如何学JAVAadds 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.


see comment above:

myLoader.mouseEnabled = false;


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:

myLoader.mouseEnabled = false;
myLoader.cacheAsBitmap = true;

This speeds up rendering and the flashing goes away.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜