Skip to main content
Inspiring
April 6, 2013
Question

Same Effect with different MovieClips

  • April 6, 2013
  • 1 reply
  • 361 views

I want to have my text light up when you mouse over it.  The text is within a box to make it easier to read.  I would like to know how to make it so the text in the box will light up, no matter what the text is.  I know how to do this individually, but I was wondering if there was a way to save time so I wouldn't have to write a function for each text box.  Here is the code I have to make it glow:

alley1.talkAlley.addEventListener(MouseEvent.ROLL_OVER, alleyQuestion);

alley1.talkAlley.addEventListener(MouseEvent.ROLL_OUT, alleyQuestionOut);

var glow:GlowFilter = new GlowFilter();

glow.color = 0xFFFFFF;

glow.alpha = 1;

glow.blurX = 25;

glow.blurY = 25;

glow.quality = BitmapFilterQuality.MEDIUM;

function alleyQuestion(event:MouseEvent) : void

{   

    alley1.talkAlley.filters = [glow];

}

function alleyQuestionOut(event:MouseEvent) : void

{

    alley.talkAlley.filters =[];

}

so, "talkAlley" is the mc text inside my first text box, entitled "alley1".  I want to be able to add more instances of text boxes and questions without having to write 10,000 functions.  Any help is much appreciated.

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
April 6, 2013

instead of using

alley1.talkAlley.filters = [glow];

use

event.currentTarget.filters = [glow];

then

add the eventlisteners to all the textboxes in aloop

for(var i:int=1; i<10;i++){

     getChildByName("alley"+i).talkAlley.addEventListener(MouseEvent.ROLL_OVER, alleyQuestion);

     getChildByName("alley"+i).talkAlley.addEventListener(MouseEvent.ROLL_OUT, alleyQuestionOut);

}