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

Process each child of a movie clip?

Engaged ,
Dec 07, 2009 Dec 07, 2009

Copy link to clipboard

Copied

I have a movie clip on stage with several other movie clips inside of it.  How do I refer to each child so I might do stuff to it?  I have done it once before by name, but I'd rather not rely on names:

private function setUpHotSpots():void {                // loop through all the hot spots, hide them, and assign event handlers                var i:int;                var numberOfHotSpots:int = hotSpots_mc.numChildren;                for (i = 0; i < numberOfHotSpots; i++) {                     this["hotSpot"+i].alpha=0;                     this["hotSpot"+i].addEventListener("hotSpotClicked", hotSpotClickHandler);                }           }

TOPICS
ActionScript

Views

271

Translate

Translate

Report

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
Community Expert ,
Dec 07, 2009 Dec 07, 2009

Copy link to clipboard

Copied

LATEST

use:

for(var i:uint=0;i<parentobject.numChildren;i++){

var displayobject:DisplayObject=parentobject.getChildAt(i);

//

}

Votes

Translate

Translate

Report

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