简体   繁体   中英

Adobe Animate, how to reference nested HTML5 movieclips using a variable

In Animate HTML5 canvas I have a bunch of sequentially numbered movieclip instances I want to stop playing using a repeat loop. The basic syntax is:

this.data_rings.ring1.stop()

My problem is I can't determine how to refer to the clips using a variable. Trying variations of the following has no effect:

for (i = 1; i < 10; i++) { 
    theClip = "data_rings.ring" + i;
    this.theClip.stop();
}

I'm guessing this has something to do with scope but don't know what to change. Any suggestion for how to fix?

Received an answer in the Adobe forums, for anyone that's interested.
Use the drawstart event and bracket notation:

stage.on("drawstart", function(e)  
{  
    for (var i = 1; i < 10; i++)  
          this.data_rings["ring" + i].stop();  
}, this, true);  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM