Packagecom.mosesSupposes.bitmap
Classpublic class InteractivePNG
InheritanceInteractivePNG Inheritance flash.display.MovieClip

Like magic, transparent parts of a PNG in this MovieClip are ignored during mouse interactions.

No special instructions are needed to use this class if the clip's artwork does not change during play, simply use this class in place of MovieClip. If the MovieClip animates or changes, you can call drawBitmapHitArea() at any time to refresh the hit area.



Public Properties
 PropertyDefined by
  alphaTolerance : uint
Set to 0 to detect hit on any pixel that is not completely transparent, or 255 detect only completely opaque pixels.
InteractivePNG
  interactivePngActive : Boolean
[read-only] Whether this MovieClip is using InteractivePNG functionality.
InteractivePNG
Public Methods
 MethodDefined by
  
InteractivePNG functionality is active from instantiation, but can be turned off at any time by calling disableInteractivePNG().
InteractivePNG
  
Turns off the functionality of this class.
InteractivePNG
  
drawBitmapHitArea(event:Event = null):void
A hit-detection bitmap is generated on the first mouse interaction with the clip, but you may need to call this method or use it as an ENTER_FRAME handler to refresh the hit area if the clip's shape changes during play.
InteractivePNG
  
Restores functionality of this class if it was previously disabled.
InteractivePNG
Property detail
alphaToleranceproperty
alphaTolerance:uint  [read-write]

Set to 0 to detect hit on any pixel that is not completely transparent, or 255 detect only completely opaque pixels.

The default value is 128.

Implementation
    public function get alphaTolerance():uint
    public function set alphaTolerance(value:uint):void
interactivePngActiveproperty 
interactivePngActive:Boolean  [read-only]

Whether this MovieClip is using InteractivePNG functionality.

Functionality is enabled by default from instantiation. Only returns false if disableInteractivePNG() has been called. (Note that setting hitArea or mouseEnabled may result in a disable in certain cases, see documentation in the class file for more information on this topic.)

Implementation
    public function get interactivePngActive():Boolean

See also

Constructor detail
InteractivePNG()constructor
public function InteractivePNG()

InteractivePNG functionality is active from instantiation, but can be turned off at any time by calling disableInteractivePNG().

Method detail
disableInteractivePNG()method
public function disableInteractivePNG():void

Turns off the functionality of this class. Note that setting hitArea or mouseEnabled may result in a disable in certain cases (see documentation in the class file for more information on this topic).

See also

drawBitmapHitArea()method 
public function drawBitmapHitArea(event:Event = null):void

A hit-detection bitmap is generated on the first mouse interaction with the clip, but you may need to call this method or use it as an ENTER_FRAME handler to refresh the hit area if the clip's shape changes during play.

Parameters
event:Event (default = null) — Provided so this method can be used as an event handler with no extra work.
enableInteractivePNG()method 
public function enableInteractivePNG():void

Restores functionality of this class if it was previously disabled. This method will have no effect if hitArea has been set.

See also