-
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
-
HELP>>>ACTIONSCRIPT DICTIONARY
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
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|