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

Can a var unite mc's into a group to assign events?

Explorer ,
Jan 23, 2013 Jan 23, 2013

I would like a set of MC buttons react a certain way on the screen. For this I did not wan to group then into another one MC but decided to make a var with them. However it does not seem to work. Is it possible?

Here is my not working code:

var dimmedLyteRing_arr:Array = new Array(IntroIMGS_COLLAGE.AppsIntro.coolingreflectionsIntro_btn, IntroIMGS_COLLAGE.AppsIntro.towerspectaculaireIntro_btn, IntroIMGS_COLLAGE.AppsIntro.CountryTowerIntro_btn, IntroIMGS_COLLAGE.AppsIntro.FlamelessTabletopAccentsIntro_btn, IntroIMGS_COLLAGE.AppsIntro.SilverBloomIntro_btn, IntroIMGS_COLLAGE.AppsIntro.gazingglowIntro_btn);

dimmedLyteRing_arr.buttonMode=true;

dimmedLyteRing_arr.useHandCursor = true;

Here is my full version of non working code:

//set up a vars array for a set of images to dim on MOUSE_OVER/OUT

var dimmedLyteRing_arr:Array = new Array(IntroIMGS_COLLAGE.AppsIntro.coolingreflectionsIntro_btn, IntroIMGS_COLLAGE.AppsIntro.towerspectaculaireIntro_btn, IntroIMGS_COLLAGE.AppsIntro.CountryTowerIntro_btn, IntroIMGS_COLLAGE.AppsIntro.FlamelessTabletopAccentsIntro_btn, IntroIMGS_COLLAGE.AppsIntro.SilverBloomIntro_btn, IntroIMGS_COLLAGE.AppsIntro.gazingglowIntro_btn);

dimmedLyteRing_arr.buttonMode=true;

dimmedLyteRing_arr.useHandCursor = true;

//set up a vars array for a set of images to make dimLyteRing_arr to dim on MOUSE_OVER/OUT

var dimmerLyteRing_arr:Array = new Array(IntroIMGS_COLLAGE.prdctsIntro.LyteRing6SMTIntro_btn);

//var dimLyteRing_Tween:TweenMax = TweenMax.allTo(dimLyteRing_arr, 1, {scaleX:.7, scaleY:.7, colorMatrixFilter:{saturation:.1, brightness:.5}, paused:true});

var dimLyteRing_Tween:TweenMax = TweenMax.to(dimmedLyteRing_arr, .5, {alpha:.5, paused:true});

dimmerLyteRing_arr.addEventListener(MouseEvent.MOUSE_OVER, navOver_dimLyteRing_arr);

dimmerLyteRing_arr.addEventListener(MouseEvent.MOUSE_OUT, navOut_dimLyteRing_arr);

                    

          function navOver_dimLyteRing_arr(e:MouseEvent):void{

         dimLyteRing_Tween.play();

         }

        

          function navOut_dimLyteRing_arr(e:MouseEvent):void{

         dimLyteRing_Tween.reverse();

         }

TOPICS
ActionScript
445
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

correct answers 1 Correct answer

Guru , Jan 23, 2013 Jan 23, 2013

You can not have a Array listening for MouseEvents.

To be able to listen for MouseEvents an Object has to be a DisplayObject.

What you can do, though, is adding any DisplayObject to an Array, and then looping through the Array and assign your EventListeners individually.

Translate
Guru ,
Jan 23, 2013 Jan 23, 2013
LATEST

You can not have a Array listening for MouseEvents.

To be able to listen for MouseEvents an Object has to be a DisplayObject.

What you can do, though, is adding any DisplayObject to an Array, and then looping through the Array and assign your EventListeners individually.

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