A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: on(Rollover) {bring to front}

  1. #1
    Style before Substance
    Join Date
    Mar 2003
    Location
    Geneva, Switz.
    Posts
    202

    on(Rollover) {bring to front}

    I have several buttons on the stage, but because they all overlap, I need which even one you mouseover to change it's depth so that it is on top.

    I tried doing something like:
    Code:
    on (rollOver) {
    	trace(_this.getDepth());
    	_this.swapDepths(1);
    }
    ... but it doesn't seem to have the required effect. And the trace outputs a figure like "-16375".

  2. #2
    Member
    Join Date
    Aug 2006
    Location
    Australia
    Posts
    64
    This code only works for movie clips........

    frame script:

    btn1.onRelease = function () {
    this.swapDepths(this.getNextHighestDepth());
    };
    btn2.onRelease = function () {
    this.swapDepths(this.getNextHighestDepth());
    };
    btn3.onRelease = function () {
    this.swapDepths(this.getNextHighestDepth());
    };
    btn4.onRelease = function () {
    this.swapDepths(this.getNextHighestDepth());
    };

  3. #3
    Style before Substance
    Join Date
    Mar 2003
    Location
    Geneva, Switz.
    Posts
    202
    It has to be buttons, not movieclips.

    Do buttons not support swapDepths() ??

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,875
    Code:
    var oldDepth:Number;
    
    btn.onRollOver = function(){
    	oldDepth = this.getDepth();
    	this.swapDepths(_root.getNextHighestDepth());
    }
    
    btn.onRollOut = function(){
    	this.swapDepths(oldDepth); 
    }
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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