Files
ai-resume/content/assets/code/01-actionscript-class.as

37 lines
958 B
ActionScript

package thebeer {
import utils.Bg;
import com.greensock.TweenMax;
import flash.display.MovieClip;
import flash.events.Event;
/**
* @author samrolfe
*/
public class Siren extends MovieClip {
private var targ : Bg;
private var delays : Number;
private var wide: Number;
private var high: Number;
public function Siren(col:Number,t:Bg,d:Number) {
delays=d;
targ=t;
x=targ.x;
y=targ.y;
wide=this.width;
high=this.high;
TweenMax.to(this,0,{autoAlpha:0,colorMatrixFilter:{colorize:col}});
}
private function setPos(e:Event) : void {
x=parent[targ].x;
y=parent[targ].y;
}
public function flash() : void {
TweenMax.to(this,0,{autoAlpha:1,width:wide,height:high});
TweenMax.to(this,.1,{width:0,height:0,repeat:5,repeatDelay:delays,yoyo:true,onComplete:finish});
}
public function finish() : void {
TweenMax.killTweensOf(this);
TweenMax.to(this,2,{autoAlpha:0,width:0,height:0});
}
}
}