1

Heyya, Community!

So, I've been programming in Flash ActionScript 3.0 for a few years, gradually relearning everything. However, I can't figure this out for the life of me -- I've been forced to use inefficient work-arounds since now. And I just needed to know, how can I stop MovieClips added via The Stage consisting through frames?

Code;

Frame 1;

import flash.display.MovieClip;

var block_mc:MovieClip = new Block();
addChild(block_mc);
block_mc.x = 100;
block_mc.y = 100;

And then, on Frame 2...

stop();

How can I stop this issue from happening? If you want a more specific example, you can download the supplied .fla file.

Is there an efficient work-around other than creating for() loops to delete my greater-than 100 MovieClips? Is there no work-around? Please help!

Please note, to open the file you need a version of Adobe Flash Professional; I recommend using Adobe Flash Professional CC if you have it, since I used it.

If you need any more details, just ask! <3

Link to FLA: http://www.mediafire.com/download/tczfyj3jg3sofsj/Problem.fla

  • Is `removeChild(block_mc);` not good enough for this? – VC.One May 11 '16 at 10:02
  • Like I said, it is for single MovieClips but I have situations where I have 100+ MovieClips added to the stage. Any way to remove *everything*? – Peter Kristo PeterGlassJar May 11 '16 at 10:04
  • You have to use a `for` loop for that. I'm fast reading cos I have to go soon (sorry if I missed any important points). – VC.One May 11 '16 at 10:06
  • Alright... Well, is there a way to cycle between all single MovieClips?; as opposed to having MovieClips pushed into arrays when I add them? – Peter Kristo PeterGlassJar May 11 '16 at 10:08
  • 1
    Before that... it just occured to me, you could add them to a container MC instead of stage itself. Then simply remove that container when not needed. So use `containerMC.addChild(block_mc);` then even if it has 100 MC children, use `removeChild(containerMC.);`. You could consider `containerMC.visible = false;` to avoid deleting in case you need it later – VC.One May 11 '16 at 10:11
  • 1
    @VC.One Yep, great idea. I thought of it in the past but was reluctant due to being confused with positioning, but I've got it down now. Thanks for reminding! <3 – Peter Kristo PeterGlassJar May 11 '16 at 10:14
  • Glad you found your solution. Don't ever be reluctant to try any possible fix before asking online. Trying `var contMC : MovieClip = new MovieClip;` is faster than typing that whole question & also waiting for an answer. – VC.One May 11 '16 at 12:05
  • What's the problem with adding them to an array? How do you add those 100+ movieclips? – null May 11 '16 at 17:25
  • @null I just feel it's inefficient having a load of for() loops. – Peter Kristo PeterGlassJar May 12 '16 at 07:29
  • Your concern is invalid. Using a for loop and an array would work just fine. – null May 12 '16 at 08:03
  • I know, but... Arrays... computers... eh... I tried. – Peter Kristo PeterGlassJar May 12 '16 at 08:08

0 Answers0