actionscript 3 - Add Child Behind existing object AS3 -


i have made game using flash cs5 (as3) , trying add child stage behind objects there. example, have bar @ bottom of screen there time start game , have falling objects want fall behind it, instead fall in front of because added them stage after. there way of adding falling objects behind without having keep re-adding bar stage? in advance.

you can create sprites act layers, , add different objects them. here example adds layer adding whatever want behind bar layer, , adds bar layer, on top. it's super rough since don't have code reference:

package  {     import flash.display.*;     public class test extends movieclip {          var barlayer:sprite;         var objectlayer:sprite;          public function test() {              var objectlayer = new sprite();             //add object layer main class             this.addchild(objectlayer);              //now can add movie clips or sprites objectlayer whenever              //then create bar layer             var barlayer = new sprite();              //add bar display object here             var bar = new movieclip();//draw bar or reference library object you've created             barlayer.addchild(bar);              //now add barlayer             this.addchild(barlayer);                 }     } } 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -