Created
December 16, 2010 23:45
-
-
Save rjungemann/744235 to your computer and use it in GitHub Desktop.
traverses a tree of DisplayObjects, calling the callback function on each
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// traverses a tree of DisplayObjects, calling the callback function on each | |
function descendClips(clip, callback) { | |
callback(clip); | |
for(var i = 0; i < clip.numChildren; i++) { | |
var child = clip.getChildAt(i); | |
try { descendClips(child, callback); } catch(e) {} | |
} | |
} | |
// whatever function is specified as the second argument gets called for each clip | |
descendClips(this, function(clip) { clip.stop() }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment