I’ve created an animation based on the Tween Class 2 Tutorial on this site. Currently everything is working correctly, but I’ve written the same code 3 times for three different text boxes inside movieclips. Is there a way to condense this code to make it more efficient? My code is below. Thanks!
Actions Layer
//
var gf:GlowFilter = new GlowFilter(0xffffff, 50, 4, 4, 4, 2, false, false);
var gfBX:Tween = new Tween(gf, "blurX", Elastic.easeOut, 4, 4, 1, true);
var gfBY:Tween = new Tween(gf, "blurY", Elastic.easeOut, 4, 4, 1, true);
gfBX.onMotionChanged = function() {
aboutUsAnim_mc.kText.filters = [gf];
};
//
var me:GlowFilter = new GlowFilter(0xffffff, 50, 4, 4, 4, 2, false, false);
var meCX:Tween = new Tween(me, "blurX", Elastic.easeOut,4, 4, 1, true);
var meCY:Tween = new Tween(me, "blurY", Elastic.easeOut, 4,4, 1, true);
meCX.onMotionChanged = function() {
menuAnim_mc.kText.filters = [me];
};
//
var co:GlowFilter = new GlowFilter(0xffffff, 50, 4, 4, 4, 2, false, false);
var coDX:Tween = new Tween(co, "blurX", Elastic.easeOut,4, 4, 1, true);
var coDY:Tween = new Tween(co, "blurY", Elastic.easeOut, 4,4, 1, true);
coDX.onMotionChanged = function() {
contactAnim_mc.kText.filters = [co];
};
Code on button 1
on (rollOver) {
gfBX.continueTo(10, 2);
gfBY.continueTo(10, 2);
}
on (rollOut, dragOut) {
gfBX.continueTo(5, 5);
gfBY.continueTo(5, 5);
}
Code on button 2
on (rollOver) {
meCX.continueTo(10, 2);
meCY.continueTo(10, 2);
}
on (rollOut, dragOut) {
meCX.continueTo(5, 5);
meCY.continueTo(5, 5);
}
Code on button 3
on (rollOver) {
coDX.continueTo(10, 2);
coDY.continueTo(10, 2);
}
on (rollOut, dragOut) {
coDX.continueTo(5, 5);
coDY.continueTo(5, 5);
}