Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Same Effect with different MovieClips

Participant ,
Apr 06, 2013 Apr 06, 2013

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.

TOPICS
ActionScript
335
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 06, 2013 Apr 06, 2013
LATEST

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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines