Skip to main content
Inspiring
March 21, 2022
Question

Accessing movieClip.children expect one named movieClip

  • March 21, 2022
  • 1 reply
  • 212 views

I have been trying to access all children of a movie clip except one and can't find a way of doing it... has anybody discovered this. My example shows how I was trying to do this a click action works for all but need to exclude one named movieClip.

var root = this;  
  
root.fadeCountries = function(e)  
{  
    stage.off("drawstart", root.drawStart);  
  
    root.mapBtns.children.forEach(function(countries) 
    {   
          createjs.Tween.get(countries).to({alpha:0.5}, 500, createjs.Ease.quadOut);
    });

};
  
this.mapBtns.btn1.addEventListener("click", mapBtns1.bind(this));

function mapBtns1() 
{
	root.drawStart = stage.on("drawstart", root.fadeCountries, null, true);
}

 

    This topic has been closed for replies.

    1 reply

    Legend
    March 21, 2022

    Don't use forEach. Use a normal for loop to iterate over the children array, so you can include a check to skip over whatever members you don't want to process.