
Код:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.BlurFilter;
class Screamge.Motion.BTwin {
private var it:MovieClip;
private var xcor:Number;
private var ycor:Number;
private var frame:Number;
private var times:Number;
private var currentypos:Number;
private var blurer:Boolean = false;
static private var xblur:Number = 3;
private var yblur:Number;
static private var quality:Number = 5;
public var motype:Function;
public function showtips (){
trace ("Elastic")
trace ("Bounce")
trace ("Back")
trace ("Strong")
}
public function setBlur (){
blurer = true;
}
public function setType (nam:String, ease:String){
if (nam == "Elastic"){
if (ease == "In"){
motype = Elastic.easeIn;
}
else if (ease == "Out"){
motype = Elastic.easeOut;
}
else if (ease == "InOut"){
motype = Elastic.easeInOut;
}
}
else if (nam == "Bounce"){
if (ease == "In"){
motype = Bounce.easeIn
}
else if (ease == "Out"){
motype = Bounce.easeOut
}
else if (ease == "InOut"){
motype = Bounce.easeInOut
}
}
else if (nam == "Back"){
trace ("back")
if (ease == "In"){
motype = Back.easeIn;
}
else if (ease == "Out"){
motype = Back.easeOut;
}
else if (ease == "InOut"){
motype = Back.easeInOut
}
}
else if (nam == "Strong"){
if (ease == "In"){
motype = Strong.easeIn;
}
else if (ease == "Out"){
motype = Strong.easeOut
}
else if (ease == "InOut"){
motype = Strong.easeInOut
}
}
else {
motype = None.easeNone;
}
}
public function setName (nam:MovieClip){
it = nam;
}
public function initMove (xcord:Number, ycord:Number, timemove:Number, framecount:Number){
times = timemove;
xcor = xcord;
ycor = ycord;
frame = framecount;
if (times == 0){
var itmove:Tween = new Tween (it, "_x", motype, it._x , xcor, frame);
var itmove:Tween = new Tween (it, "_y", motype, it._y, ycor, frame)
}
else {
var it1move:Tween = new Tween (it, "_x", motype , it._x , xcor, times, true);
var it2move:Tween = new Tween (it, "_y", motype , it._y, ycor, times, true);
if (blurer == true){
it2move.onMotionChanged = function (){
trace (this.position)
yblur = ycor - this.position
var setBlur:BlurFilter = new BlurFilter (xblur, yblur,quality)
var filar:Array = new Array ()
filar.push(setBlur)
it.filters = filar;
}
}
}
}
}