Packagecom.threerings.display
Classpublic class BackgroundJPGEncoder
InheritanceBackgroundJPGEncoder Inheritance flash.events.EventDispatcher

Class that will encode a jpeg in the background and fire an event when it's done.



Protected Properties
 PropertyDefined by
  _encoder : JPGEncoder
BackgroundJPGEncoder
  _timer : Timer
BackgroundJPGEncoder
  _timeSlice : int
BackgroundJPGEncoder
Public Methods
 MethodDefined by
  
BackgroundJPGEncoder(image:BitmapData, quality:Number = 50, timeSlice:int = 100)
Construct a jpeg encoder.
BackgroundJPGEncoder
  
cancel():void
Cancel encoding and discard any intermediate results.
BackgroundJPGEncoder
  
start():void
Start encoding
BackgroundJPGEncoder
Protected Methods
 MethodDefined by
  
timerHandler(event:TimerEvent):void
BackgroundJPGEncoder
Events
 EventSummaryDefined by
   Dispatched when the jpeg is complete.BackgroundJPGEncoder
Protected Constants
 ConstantDefined by
  PIXEL_GRANULARITY : int = 100
BackgroundJPGEncoder
Property detail
_encoderproperty
protected var _encoder:JPGEncoder
_timerproperty 
protected var _timer:Timer
_timeSliceproperty 
protected var _timeSlice:int
Constructor detail
BackgroundJPGEncoder()constructor
public function BackgroundJPGEncoder(image:BitmapData, quality:Number = 50, timeSlice:int = 100)

Construct a jpeg encoder. Once started, the encoder will encode a jpeg over the course of multiple frames, generating an event to deliver the finished jpeg when it is done.

Parameters
image:BitmapData — The bitmap to encode.
 
quality:Number (default = 50) — The jpeg quality from 1 to 100 which determines the compression level.
 
timeSlice:int (default = 100) — The number of milliseconds of processing to do per frame.
Method detail
cancel()method
public function cancel():void

Cancel encoding and discard any intermediate results.

start()method 
public function start():void

Start encoding

timerHandler()method 
protected function timerHandler(event:TimerEvent):voidParameters
event:TimerEvent
Event detail
completeevent 
Event object type: com.threerings.util.ValueEvent

Dispatched when the jpeg is complete. The 'value' property will contain the received data.

Constant detail
PIXEL_GRANULARITYconstant
protected const PIXEL_GRANULARITY:int = 100