Ok. So it’s already understood that my logic for creating these classes might be faulty. But here we go. All I wanted to do was attach animations to an object in a way like style sheets. But, I’ve run into runtime problems … like, the animations don’t always finish … or ever finish, and unless its published and viewed on the web, its very choppy when previewing in Flash CS3. So here we go …
My simple transition class:
package com.version2.utils {
import flash.display.MovieClip;
import flash.events.Event;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
public class Transition {
public var mc:MovieClip;
function Transition(t:MovieClip){
mc = t;
}
public function opacity(o:Object) {
var clip:MovieClip = mc;
var start:Number = o.start;
var end:Number = o.end;
var alphaDur:Number = o.alphaDur;
var alphaTween:Tween = new Tween(clip, "alpha", Strong.easeOut, start, end, alphaDur, true);
}
}
}
My Style class:
package com.version2.utils{
import flash.display.MovieClip;
import com.version2.utils.Transition;
public class Style{
public function LogoIn(obj:Object)
{
var effect:Transition = new Transition(obj.MC);
effect.opacity({start:0, end:obj.Alpha, alphaDur:1});
}
}
}
And then to use the style class:
var logo:Logo = new Logo();
logo.name = "logo";
logo.alpha = 0;
addChild(logo);
var style:Style = new Style();
style.LogoIn({MC:logo});
So is this just bad coding? Why would animations not finish? Grrr … I wish I had the answers.