Game Development Reference
In-Depth Information
Here is the complete listing for the simple event class:
package pulseui.util
{
import flash.events.Event;
public class SpriteDissolveEvent extends Event
{
public static const DONE:String = "done";
public function SpriteDissolveEvent(type:String,
bubbles:Boolean=false,
cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
}
}
Here is the complete listing for the SpriteDissolve class:
package pulseui.util
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.filters.ColorMatrixFilter;
import flash.utils.Timer;
public class SpriteDissolve extends EventDispatcher
{
// We do the fading in 200 steps
private static var m_maxSteps:int = 200;
// starting alpha from 1.0 = opaque
private static const s_alphaFrom:Number = 1.0;
// ending alpha to 0 = 100% transparent
private static const s_alphaTo:Number = 0.0;
// determine what the change in alpha should be at each step.
private static const s_alphaStep:Number =
(s_alphaFrom - s_alphaTo)/m_maxSteps;
// store the passed in paramters
private var m_parent:Sprite;
private var m_targets:Array;
private var m_timer:Timer;
 
Search WWH ::




Custom Search