home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 145
/
MOBICLIC145.ISO
/
pc
/
DATA
/
DSS145
/
DSS145_07
/
DSS145_07.swf
/
scripts
/
dss145_07
/
FadeOut.as
< prev
next >
Wrap
Text File
|
2012-07-18
|
1KB
|
55 lines
package dss145_07
{
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.Event;
public class FadeOut extends Sprite
{
public var color:Number = 0;
public var speed:Number = 0.1;
private var _callback:Function = null;
public function FadeOut(param1:DisplayObjectContainer, param2:Function = null)
{
super();
param1.addChild(this);
this._callback = param2;
this.init();
}
private function init() : void
{
graphics.beginFill(this.color,1);
graphics.drawRect(0,0,800,600);
graphics.endFill();
}
public function start() : void
{
alpha = 1;
stage.addEventListener(Event.ENTER_FRAME,this.enterFrameHandler);
}
private function enterFrameHandler(param1:Event) : void
{
alpha -= this.speed;
if(alpha <= 0)
{
this.finish();
}
}
public function finish() : void
{
stage.removeEventListener(Event.ENTER_FRAME,this.enterFrameHandler);
parent.removeChild(this);
this._callback();
}
}
}