Game Development Reference
In-Depth Information
// per play vars
// Keep track of the count the timer has fired
private var m_count:int;
// Current alpha value being applied to the sprites
private var m_alpha:Number;
// For external query
private var m_isDone:Boolean;
/**
*
* @param parent Parent of the sprites, could be null
* @param sprites Sprites that need to be dissolved
*
*/
public function SpriteDissolve(parent:Sprite, sprites:Array) {
// Initialze
m_parent = parent;
m_targets = sprites;
m_isDone = false;
// set up the timer
m_timer = new Timer(10);
m_timer.addEventListener(TimerEvent.TIMER, dissolve);
}
/**
* A convenience factory method to create sprite
* dissolve instance, when there is only one sprite to
* dissolve.
*
* @param parent Parent of the sprite, could be null
* @param sprite Sprite to dissolve
*
*/
public static function
createSpriteDissolve(parent:Sprite,
sprite:Sprite):
SpriteDissolve
{
var a:Array = new Array();
a.push(sprite);
return new SpriteDissolve(parent, a);
}
/**
* External interface to control the dissolve speed
* @param steps default is 200
*
*/
 
Search WWH ::




Custom Search