Simplify code

Hello You coders out there:)
I’ve attached a code here, everything is working fine, no problems, my question is the following how can I simplyfy the glowfilter effect?
I tried putting it in a function but something was wrong… there is no problem with the text sliding function, tried to add a function for the glow as well but dunno amybe I was missing something because it did not come out as I wanted.

As you can see I have initialised the filter itself 5 times and wrote the code for every button independantly, which resulted in a quite long code…
This is why I want to simplify…to automate a bit:)

Guess this is just tweaking -I’m not a big coder myself, just reading forums, examples and reading more examples, then trying them on my own.

So if someone out there might be able to help me I1d give a big THX :slight_smile:

#include "lmc_tween.as"
Stage.scaleMode = "noScale";

//button_labels
b1.item.menuitem.text = "MAGUNKRÓL";
b2.item.menuitem.text = "ELEMJEGYZÉK";
b3.item.menuitem.text = "FRONTVÁLASZTÉK";
b4.item.menuitem.text = "KIEGÉSZÍTŐK";
b5.item.menuitem.text = "KAPCSOLAT";

//---text_movement function
function txt_over(myMC) {
    myMC.tween("_x",70, 0.6, "easeOutBounce");
}
function txt_out(myMC) {
    myMC.tween("_x",12, 0.6, "easeOutBounce");
}
//-----------------------------------------------


//--------glow_fx
import flash.filters.*; 

var gf1:GlowFilter = new GlowFilter(0xf7ff9a, 26, 0, 0, 3, 3, true, false);
var gf2:GlowFilter = new GlowFilter(0xf7ff9a, 26, 0, 0, 3, 3, true, false);
var gf3:GlowFilter = new GlowFilter(0xf7ff9a, 26, 0, 0, 3, 3, true, false);
var gf4:GlowFilter = new GlowFilter(0xf7ff9a, 26, 0, 0, 3, 3, true, false);
var gf5:GlowFilter = new GlowFilter(0xf7ff9a, 26, 0, 0, 3, 3, true, false);

// Ordinary glow effects
b1.bg.filters = [gf1];
b2.bg.filters = [gf2];
b3.bg.filters = [gf3];
b4.bg.filters = [gf4];
b5.bg.filters = [gf5];


gf1.blurX += (1-gf1.blurX)/3;
gf1.blurY = gf1.blurX;

gf2.blurX += (1-gf2.blurX)/3;
gf2.blurY = gf2.blurX;

gf3.blurX += (1-gf3.blurX)/3;
gf3.blurY = gf3.blurX;

gf4.blurX += (1-gf4.blurX)/3;
gf4.blurY = gf4.blurX;

gf5.blurX += (1-gf5.blurX)/3;
gf5.blurY = gf5.blurX;
//---------------------
b1.bg.onRollOver = function() {
txt_over(b1.item);
//What happens
this.onEnterFrame = function() {
gf1.blurX += (10-gf1.blurX)/3;
gf1.blurY = gf1.blurX;
b1.bg.filters = [gf1];

}
}

b1.bg.onRollOut = function() {
txt_out(b1.item);
this.onEnterFrame = function() {
gf1.blurX += (1-gf1.blurX)/3;
//When the mouse rolls off the image the images glow is affected.
gf1.blurY = gf1.blurX;
b1.bg.filters = [gf1];
if(gf1.blurX < 1) {
delete this.onEnterFrame;

}
}
}
//---------------------
b2.bg.onRollOver = function() {
    txt_over(b2.item);

this.onEnterFrame = function() {
gf2.blurX += (10-gf2.blurX)/3;
gf2.blurY = gf2.blurX;
b2.bg.filters = [gf2];
}
}

b2.bg.onRollOut = function() {
    txt_out(b2.item);
this.onEnterFrame = function() {
gf2.blurX += (1-gf2.blurX)/3;

gf2.blurY = gf2.blurX;
b2.bg.filters = [gf2];
if(gf2.blurX < 1) {
delete this.onEnterFrame;
}
}
}
//---------------------
b3.bg.onRollOver = function() {
    txt_over(b3.item);
//What happens
this.onEnterFrame = function() {
gf3.blurX += (10-gf3.blurX)/3;
gf3.blurY = gf3.blurX;
b3.bg.filters = [gf3];
}
}

b3.bg.onRollOut = function() {
    txt_out(b3.item);
this.onEnterFrame = function() {
gf3.blurX += (1-gf3.blurX)/3;

gf3.blurY = gf3.blurX;
b3.bg.filters = [gf3];
if(gf3.blurX < 1) {
delete this.onEnterFrame;
}
}
}
//---------------------
b4.bg.onRollOver = function() {
    txt_over(b4.item);

this.onEnterFrame = function() {
gf4.blurX += (10-gf4.blurX)/3;
gf4.blurY = gf4.blurX;
b4.bg.filters = [gf4];
}
}

b4.bg.onRollOut = function() {
    txt_out(b4.item);
this.onEnterFrame = function() {
gf4.blurX += (1-gf4.blurX)/3;

gf4.blurY = gf4.blurX;
b4.bg.filters = [gf4];
if(gf4.blurX < 1) {
delete this.onEnterFrame;
}
}
}
//---------------------
b5.bg.onRollOver = function() {
    txt_over(b5.item);

this.onEnterFrame = function() {
gf5.blurX += (10-gf5.blurX)/3;
gf5.blurY = gf5.blurX;
b5.bg.filters = [gf5];
}
}

b5.bg.onRollOut = function() {
    txt_out(b5.item);
this.onEnterFrame = function() {
gf5.blurX += (1-gf5.blurX)/3;

gf5.blurY = gf5.blurX;
b5.bg.filters = [gf5];
if(gf5.blurX < 1) {
delete this.onEnterFrame;
}
}
}
//-------END OF glow_fx