Sometimes, specially in Flash banners, we really need to bring down the file size.
One solution is to use programmatic animation, however if you are using TweenNano you might have experience 2 of its drawbacks:
- You can not use filters
- You can not use frame tweens
This is due to the fact that TweenNano does not support the TweenLite plug-ins.
However there is a very simple solution to incorporate both options without modifying the TweenNano code (you can even think of other solutions you can apply with this methodology).
Create some fake values you will apply every time the tween updates.
import com.greensock.TweenNano;
import com.greensock.easing.*;
//mc is the instance name of a movie (with 50 frames on it) on the stage
//Movieclips are dynamic classes therefore you can add any property you want
mc.frameValue = 1;
mc.blurValue = 0;
mc.strengthValue = 0;
applyGlow(); //init the movie
function applyGlow(){
//round up since is not possible to pass floating values or zero
mc.gotoAndStop(Math.ceil(mc.frameValue));
//apply the values as they tween
mc.filters = [new GlowFilter(0xFF0000, 1, mc.blurValue, mc.blurValue, mc.strengthValue)];
}
//call the custom function on every update
//you can combine actual properties with the fake ones on the tween
TweenNano.to(mc, 3, {x:300, delay:2, ease:Elastic.easeOut, frameValue:50, blurValue:60, strengthValue:1.5, onUpdate:applyGlow});