A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to bring a movie clips to front actionscript?

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    1

    Lightbulb How to bring a movie clips to front actionscript?

    Hi!
    Need help!

    I have 114 drag movie clips (one on other, overlapping movie) on the same frame. By clicking a button (on the same frame) 7 movie clips (randomize) should be visible and active to drag. Those movies that are in front are active and I can drag them, the other are visible but can not be drawn. I have used the function swapDepths(20) but it doesn’t help me.
    Here is my button script:

    Code:
    on (release) {
    	_root.gift._visible=false;
    	stopAllSounds();	
    // with drop I mean drag.
    drop1._visible = false;
    drop2._visible = false;
    drop3._visible = false;
    drop4._visible = false;
    //------//----------
    drop113._visible = false;
    drop114._visible = false;
    
    var rndnum1 = Math.floor(Math.random() * 114) + 1;
    var rndnum2 = Math.floor(Math.random() * 114) + 1;
    var rndnum3 = Math.floor(Math.random() * 114) + 1;
    var rndnum4 = Math.floor(Math.random() * 114) + 1;
    var rndnum5 = Math.floor(Math.random() * 114) + 1;
    var rndnum6 = Math.floor(Math.random() * 114) + 1;
    var rndnum7 = Math.floor(Math.random() * 114) + 1;
    
    var tong1 = this["drop" + rndnum1];
    var tong2 = this["drop" + rndnum2];
    var tong3 = this["drop" + rndnum3];
    var tong4 = this["drop" + rndnum4];
    var tong5 = this["drop" + rndnum5];
    var tong6 = this["drop" + rndnum6];
    var tong7 = this["drop" + rndnum7];
    
    tong1._visible = true;
    tong2._visible = true;
    tong3._visible = true;
    tong4._visible = true;
    tong5._visible = true;
    tong6._visible = true;
    
    //_root.swapDepths(tong);
    //this.tong1.swapDepths(20);
     
    }

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    What about
    PHP Code:
    tong1.swapDepths(tong1._parent.getNextHighestDepth()); 
    ?
    Last edited by nunomira; 10-30-2009 at 12:35 PM. Reason: in AS2 it's _parent, not parent

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