DOUtils

Kind of class:public class
Package:com.trycatch.utils
Inherits from:EventDispatcher
Classpath:com.trycatch.utils.DOUtils
File last modified:Tuesday, 09 June 2009, 10:54:57

Summary


Constructor
Constants
Class properties
  • doTrace : Boolean
    • If false this class will suspend trace statements
  • classPath : String
    • The full classPath
Class methods
  • enableClipCursor (_displayObject:Sprite) : void
    • Activates a hand cursor for a DisplayObject
  • enableClipCursors (_displayObjects:Array) : void
    • Enables clip cursors for each Sprite in the supplied Array
  • disableClipCursor (_displayObject:Sprite) : void
    • Disapbles a hard cursor for a DisplayObject
  • disableClipCursors (_displayObjects:Array) : void
    • Disables clip cursors for each Sprite in the supplied Array
  • clearDisplayList (_displayObject:DisplayObjectContainer) : Boolean
    • Clears the DisplayList of the supplied DisplayObjectContainer
  • prepMC (clip:MovieClip) : void
    • Dynamically stores initial properties to a MovieClip.
  • unprepMC (clip:MovieClip) : void
    • Garbage collection for prepMC()
  • regMouseEvents (clip:Sprite, eventOver:Function = null, eventOut:Function = null, eventClick:Function = null, eventDown:Function = null, eventUp:Function = null, useChildren:Boolean = false) : void
    • Quick and DIRTaaaaY way to register a clip to receive mouse events.
  • removeMouseEvents (clip:Sprite, eventOver:Function = null, eventOut:Function = null, eventClick:Function = null, eventDown:Function = null, eventUp:Function = null) : void
    • Garbage collection goodness
  • makeAlphaMask (clip:DisplayObject, mask:Sprite) : void
    • Takes a display object and a mask clip/sprite, caches them as bitmaps and applies the mask.
  • makeRectMask (clip:DisplayObject, w:int, h:int, addMask:Boolean = true) : DisplayObject
    • Takes a display object, height and width, makes a mask clip with a rectangle
  • makeContainedRectMask (clip:DisplayObject, w:int, h:int) : Sprite
    • Takes a display object, height and width, makes a mask clip with a rectangle
  • createMouseBlocker (clip:DisplayObjectContainer, margin:int = 10) : void
  • centerDO (clip:DisplayObject) : void
    • Centers the provided clip within it's scope.
  • cloneDO (clip:DisplayObject, inX:Number = 0, inY:Number = 0) : Sprite
    • Creates and returns a sprite containing a bitmap copy of the supplied display object.

Constructor

DOUtils

public function DOUtils (
) : void

DOUtils constructor

Constants

CLASSNAME

public static const CLASSNAME:String = "DOUtils"
(read)

The name of the class

Class properties

classPath

public static classPath:String
(read)

The full classPath

doTrace

public static doTrace:Boolean = true
(read,write)

If false this class will suspend trace statements

Class methods

centerDO

public static function centerDO (
clip:DisplayObject) : void

Centers the provided clip within it's scope.
Parameters:
clip:
DisplayObject.

clearDisplayList

public static function clearDisplayList (
_displayObject:DisplayObjectContainer) : Boolean

Clears the DisplayList of the supplied DisplayObjectContainer
Parameters:
_displayObject:
The DisplayObjectContainer to clear
Returns:
  • Whether or not the DisplayObjectContainer had any children to remove

cloneDO

public static function cloneDO (
clip:DisplayObject, inX:Number = 0, inY:Number = 0) : Sprite

Creates and returns a sprite containing a bitmap copy of the supplied display object.
Clones are also added to the origunal DO's scope.
Parameters:
clip:
DisplayObject.
inX :
Number.
inY :
Number.
Returns:
  • Sprite.

createMouseBlocker

public static function createMouseBlocker (
clip:DisplayObjectContainer, margin:int = 10) : void

Parameters:
clip :
DisplayObjectContainer.
margin:
int.
public:
  • createMouseBlocker Takes a clip and adds a background around it to block out mouse actions on clips behind.
Returns:
  • void.

disableClipCursor

public static function disableClipCursor (
_displayObject:Sprite) : void

Disapbles a hard cursor for a DisplayObject
Parameters:
_displayObject:
The DisplayObject to deactivate

disableClipCursors

public static function disableClipCursors (
_displayObjects:Array) : void

Disables clip cursors for each Sprite in the supplied Array
Parameters:
_displayObjects:
An Array of Sprites to disable
See also:
  • disableClipCursor

enableClipCursor

public static function enableClipCursor (
_displayObject:Sprite) : void

Activates a hand cursor for a DisplayObject
Parameters:
_displayObject:
The DisplayObject to activate

enableClipCursors

public static function enableClipCursors (
_displayObjects:Array) : void

Enables clip cursors for each Sprite in the supplied Array
Parameters:
_displayObjects:
An Array of Sprites to enable
See also:
  • enableClipCursor

makeAlphaMask

public static function makeAlphaMask (
clip:DisplayObject, mask:Sprite) : void

Takes a display object and a mask clip/sprite, caches them as bitmaps and applies the mask.
Parameters:
clip:
DisplayObject.
mask:
Sprite. Can be a MovieClip too.

makeContainedRectMask

public static function makeContainedRectMask (
clip:DisplayObject, w:int, h:int) : Sprite

Takes a display object, height and width, makes a mask clip with a rectangle
graphic the size of h and w, and applies it as a mask to the clip, then puts
both clips inside of a container sprite and returns a reference to the container.
Parameters:
clip:
DisplayObject.
w :
int.
h :
int.

makeRectMask

public static function makeRectMask (
clip:DisplayObject, w:int, h:int, addMask:Boolean = true) : DisplayObject

Takes a display object, height and width, makes a mask clip with a rectangle
graphic the size of h and w, and applies it as a mask to the clip.
Parameters:
clip :
DisplayObject.
w :
int.
h :
int.
addMask:
Boolean = true. Determines whether the mask clip is added to the display list of the clip's parent.

prepMC

public static function prepMC (
clip:MovieClip) : void

Dynamically stores initial properties to a MovieClip.

New properties include:

MovieClip.startX
MovieClip.startY
MovieClip.startSX //initial scaleX
MovieClip.startSY //initial scaleY

MovieClip.startW //initial width
MovieClip.startH //initial height
MovieClip.startR //initial rotation
MovieClip.startA //initial alpha
Parameters:
clip:
MovieClip

regMouseEvents

public static function regMouseEvents (
clip:Sprite, eventOver:Function = null, eventOut:Function = null, eventClick:Function = null, eventDown:Function = null, eventUp:Function = null, useChildren:Boolean = false) : void

Quick and DIRTaaaaY way to register a clip to receive mouse events. Pass in a clip or sprite,
some custom handlers for your mouse events, and watch it go.
Parameters:
clip :
Sprite. The MovieClip or Sprite you want dispatching mouse events.
eventOver :
Function. Your custom handler for MouseEvent.ROLL_OVER. Can be 'null.'
eventOut :
Function. Your custom handler for MouseEvent.ROLL_OUT. Can be 'null.'
eventRelease:
Function. Your custom handler for MouseEvent.CLICK. Can be 'null.'
eventDown :
Function. Your custom handler for MouseEvent.MOUSE_DOWN. Can be 'null.'
eventUp :
Function. Your custom handler for MouseEvent.MOUSE_UP. Can be 'null.'

removeMouseEvents

public static function removeMouseEvents (
clip:Sprite, eventOver:Function = null, eventOut:Function = null, eventClick:Function = null, eventDown:Function = null, eventUp:Function = null) : void

Garbage collection goodness
Parameters:
clip :
Sprite. The MovieClip or Sprite you want to stop dispatching mouse events.
eventOver :
Function. Your custom handler for MouseEvent.ROLL_OVER. Can be 'null.'
eventOut :
Function. Your custom handler for MouseEvent.ROLL_OUT. Can be 'null.'
eventRelease:
Function. Your custom handler for MouseEvent.CLICK. Can be 'null.'
eventDown :
Function. Your custom handler for MouseEvent.MOUSE_DOWN. Can be 'null.'

unprepMC

public static function unprepMC (
clip:MovieClip) : void

Garbage collection for prepMC()
Parameters:
clip:
MovieClip