A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: a stupid problem is making me pull my hair out

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    120

    a stupid problem is making me pull my hair out

    I have some simple code that is not working. I have 2 clips, a green square, and a brown square. The green one starts on top of the brown, and when I click anywhere, i want it to check if the green is on top, then swap them, otherwise nothing. Here's the code:

    trace(green.getDepth());
    trace(brown.getDepth());

    _root.onMouseDown = function() {
    if(this.green.getDepth() > this.brown.getDepth){
    trace("swap must happen");
    this.brown.swapDepths(this.green);
    }
    else {
    trace("brown is already on top");
    }
    }

    the traces return that green is -16381, and that brown is -16383.
    It's obvious that green is on top, so a swap must happen...but it never does..I get "brown is already on top". The greater than operator can't seem to use the integers received from .getDepth()... any ideas?

    thanks in advance

  2. #2
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Your problem is a typo.

    this.green.getDepth() > this.brown.getDepth()){
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    120
    aaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrggggggggggggghhh hhhhhhhhhhhh...thanks man

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