This content has been marked as final. Show 12 replies
Within the onRelease attached to myCard, 'this' refers to myCard. You don't
want a new depth within the card, you'd probably want it within the card's
parent. Also, the getNextHighestDepth() returns a number - the next highest
depth... it doesn't do anything else. What you want is the swapDepths()
If all you're cards are on the stage, you could make a layer above all of
them - stick an empty clip in there with an instance name of 'imReallyHigh'
and then do something like:
Anyway, look it up in Help, it's a MovieClip method.
Adobe Community Expert
I have tried what you suggested, but it will only work once. Once I click back through the deck, it will no longer wirk. This is the code I tried to make it work, but it doesn't do the trick either:
Any other suggestions?
Cheers for your help,
Mister Peanut - I'm assuming this is the same Mr Peanut from the keyframer forums. I don't see your problem happening, it works forever when I test it.. Please post a link to your FLA here. Thanks.
Here is my file:
I don't know why, but they will swapDepths once, but when I click on them to flip them back again, they will stay on the same level. Try clicking them both back and forth a couple of times, and you will see what's happening.
Thanks for helping on this,
I don't think I ever would've got to that point on my own. I am indebted to you. *bow* I will take a fine look at what you did, and play around with the code just to try to make it clear in my mind the hows and the whys of your code.
Thank you, thank you, thank you!
I assume that you need if and else statements so that cards are not swapped back to their original depth instead of to their new depth?
Cheers for the solution!
You were having problems cause you were assigning handlers to the same objects at different points... So, I added the if statement to check a boolean value of a variable, if its true it means do one thing, if its false do another. This handles all the operations, in one central location.
ps, i'm assuming you downloaded the file, so i took it off my server.
I spoke too soon....
I've added another card into the equation, and there's some funny swapping things happening.
I'm thinking that maybe it's not swap I want, but something that puts the mc on a new level and keeps it there. The next card clicked would go to a higher level yet and keep it there etc.....
I did a trace for each card to get which depth the card is at, and it only works for the first two cards. The second two cards do not trace a depth... I think this may be the problem...
Hi Mister Peanut,
Sorry if I'm replying with something already here, I haven't read all
the replies, but I did notice something erroneous with your original post.
...won't work. First of all, you're requesting the highest depth *in the
card*, not in the container. Also, you're not doing anything with it...the
function returns a number that you need to do something with. Try this:
This swaps the depth of the current card with the next highest available
depth in the container.
BAY NEW MEDIA
"Mister Peanut" <firstname.lastname@example.org> wrote in message
>I did a trace for each card to get which depth the card is at, and it only
>works for the first two cards. The second two cards do not trace a
>depth... I think this may be the problem...
thanks for the time to look at the original post, however, I haven't really used this code for a while. My current version of my file can be found here:
You can see that it sort of works.... but I could have just gone down the wrong path anyways.
Any advice is appreciated,