A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Depth Management problem

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    4

    Exclamation Depth Management problem

    Hi to you all.

    This is my first coding AS3 project and I'm stuck already.

    I've build a theater with curtains and all.
    After a button click I would like to load in a new "theater wall" swf, on top of the previous. And the next button will do the same.

    The theater wall slides in so can't be replaced by the previous one, it must be loaded into the next level. But at all times the curtain ("gordijn.swf") must be on top of it all.

    The way I've coded it, it will only works like this once. But when you push the button a second time the wall will load underneath the previous one...

    I was experimenting with numChildren-1 but just can't get it to work.

    Some help will be appreciated

    Code:
    var imageRequest:URLRequest = new URLRequest("gordijn.swf");
    
    var imageLoader:Loader = new Loader();
    
    imageLoader.load(imageRequest);
    stage.addChildAt(imageLoader, 1);
    
    //////////////////////////////////////////////////////////////
    
    var imageRequest2:URLRequest = new URLRequest("blauw.swf");
    
    var imageLoader2:Loader = new Loader();
    
    blauw.addEventListener(MouseEvent.CLICK, loader2);
    
    function loader2(event:MouseEvent){
    imageLoader2.load(imageRequest2);
    stage.addChildAt(imageLoader2, 1);
    }
    
    //////////////////////////////////////////////////////////////
    
    var imageRequest3:URLRequest = new URLRequest("groen.swf");
    
    var imageLoader3:Loader = new Loader();
    
    groen.addEventListener(MouseEvent.CLICK, loader3);
    
    function loader3(event:MouseEvent){
    imageLoader3.load(imageRequest3);
    stage.addChildAt(imageLoader3, 2);
    }
    
    //////////////////////////////////////////////////////////////
    
    var imageRequest4:URLRequest = new URLRequest("rood.swf");
    
    var imageLoader4:Loader = new Loader();
    
    rood.addEventListener(MouseEvent.CLICK, loader4);
    
    function loader4(event:MouseEvent){
    imageLoader4.load(imageRequest4);
    stage.addChildAt(imageLoader4, 3);
    }
    
    //////////////////////////////////////////////////////////////
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center