Hello,
I'm working on a project that involves a large number of bitmaps that all will have an alpha tween to fade them in. I am using AS3 for the tweens rather than the timeline, however every tween needs to be hand written because the code requires a discreet instance name to invoke the tween class.
My question: Is it possible to create a class like a tween manager that is simple and just invokes an Alpha tween to whatever MC it is applied to? Here is the code I'm currently using:
Actionscript Code:
var Alpha:Tween = new Tween(figures_mc, "alpha", Regular.easeIn, 0, 1, 5, true);
A whole class for managing tweens may be a little overkill for what you want. You'd probably be fine with a simple helper function that just sugar coats your tween. You could have that function return a new tween instance to you ready to go so that you could still manipulate it (start, stop, destroy) the way you do now.
First write the function that accepts parameters for the parts that differ among bitmaps. In your case it looks like only the mc is different.
Actionscript Code:
function makeAlphaTween(mc) : Tween { var tween:Tween = new Tween(mc, "alpha", Regular.easeIn, 0, 1, 5, true); return tween; }
now, whenever you need to create the tween, say for an mc called bmp1 for example: