Game Development Reference
In-Depth Information
public function setSteps(steps:int):void {
m_maxSteps = steps;
}
/**
* External interface to start the dissolve
*
*/
public function play():void {
m_count = 0;
m_alpha = s_alphaFrom;
m_timer.start();
}
/**
* Timer callback method to update the alpha on sprites
* @param event
*
*/
private function dissolve(event:Event):void {
m_count++;
// If steps are completed, remove the sprite from the// parent
if ( m_count == m_maxSteps ) {
m_timer.stop();
for each ( var s:Sprite in m_targets ) {
if ( s.parent != null && s.parent.contains(s) )
s.parent.removeChild(s);
//remove the filter
var filters:Array = s.filters;
if ( filters.length > 0 ) {
filters.pop();
s.filters = filters;
}
}
m_isDone = true;
// Fire the Dissolve done event
dispatchEvent(
new SpriteDissolveEvent(
SpriteDissolveEvent.DONE));
}
else {
// update the alpha value
m_alpha -= s_alphaStep;
//trace(m_alpha);
// call to update the filter on the sprites
 
Search WWH ::




Custom Search