# Simple AS3 Animation Engine

**URL:** <https://forum.kirupa.com/t/simple-as3-animation-engine/226724>\
**Category:** flash\
**Created:** [May 23, 2007, 2:21pm UTC](https://forum.kirupa.com/t/simple-as3-animation-engine/226724 "2007-05-23T14:21:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deltajam](https://avatars.discourse-cdn.com/v4/letter/d/7993a0/32.png) [@deltajam](https://forum.kirupa.com/u/deltajam)\
**Post date:** [May 23, 2007, 2:21pm UTC](https://forum.kirupa.com/t/simple-as3-animation-engine/226724/1 "2007-05-23T14:21:39Z")

</div>

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:

```auto

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:

```auto

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:

```auto

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.
