0

I'm currently writing a code that when executed, it'll attach lots of movieClips into the _root property. Is there is a way to choose which layer these movieClips are attached into?

For example:

_visible = false; var entitySpawn; var ID = 10; function spawnEntity(TYPE, X, Y) { entitySpawn = _root.attachMovie(TYPE, TYPE+"_"+ID, ID); entitySpawn._x = X; entitySpawn._y = Y; ID++; } 

I know that the variable ID gives it the depth, but is there a way to chose between the layers itself, so that certain movieClips are above other, no matter their depth?

4
  • IIRC, "layers" don't exist to the code. It's just a thing in the editor, so depth is what you will need to use. For less important stuff, maybe you can insert it at 0 depth, and more important stuff, the current depth? Commented Dec 30, 2024 at 15:09
  • 1
    Recently I posted an answer that exactly explains how depth management works in AS2. Although it does not directly answer your question, reading it will surely improve your understanding of what's going on there: stackoverflow.com/a/79310295/4687633 Then, the solution to your specific problem is putting empty containers between the pre-designed layers and attaching things into these containers. Commented Dec 30, 2024 at 16:47
  • @Organis Nice post. Is AS2 making some kind of comeback or something? I haven't done Flash in ages, but I thought AS3 was the way to go way back before Flash died. Commented Dec 30, 2024 at 20:05
  • 1
    @GeneralGrievance I did AS3 from 2008 through 2017 before changing my career direction, and I also believed that AS2 is dead since AS3 was intriduced, yet here we are. There's a guess though: Ruffle has a better coverage for AS2 and that just might be a reason for people to choose 2 over 3. Commented Dec 31, 2024 at 2:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.