# Buttontest problem

**URL:** https://forum.kirupa.com/t/buttontest-problem/6023
**Category:** Uncategorized
**Created:** [September 27, 2002, 8:03pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023 "2002-09-27T20:03:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)
#### Post date: [September 27, 2002, 8:03pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/1 "2002-09-27T20:03:38Z")

</div>

The attached file contains three clips with an attached script to produce an alpha effect, or there or there abouts.

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) {  
this.nextFrame();  
} else {  
this.prevFrame();  
}  
}

Problem is when you place mouse over the top clip the clips behind also animate. Simarlarly place the mouse over the secord and the third animates.

How can I prevent this and also build a swap depth command into the script.

Any ideas

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 7:12pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/2 "2002-09-28T19:12:08Z")

</div>

see if u can use this one.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 7:25pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/3 "2002-09-28T19:25:24Z")

</div>

I was working on it the other day. You can use large invisible buttons (although I don’t like these) but as in tsavos example it works ok, except the hit state of the middle layer overlaps the first. I’m going to have another look at it when I can unless it’s sorted by then.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 8:04pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/4 "2002-09-28T20:04:33Z")

</div>

found a tut about the swap thing! that improved it a little!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 8:24pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/5 "2002-09-28T20:24:16Z")

</div>

You were right in using swap depths, but I used in a simpler way try this. Just need to increase the hit area if required and make it invisible

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 9:40pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/6 "2002-09-28T21:40:13Z")

</div>

He he!THAT is simpler!! MY way was for flash 5 I think!

Where u put 100 thats to represent the number of clips right? so in this case it would be enough to type 3?  
U know some good url’s with tut, that I’ve overlooked?!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 28, 2002, 9:45pm UTC](https://forum.kirupa.com/t/buttontest-problem/6023/7 "2002-09-28T21:45:06Z")

</div>

100 represents the new depth.

instance.swapDepths(newdepth);

the higher newDepth is (how do I describe it) the higher it will be, eg, an object with depth 2 will appear over an object with depth 1.

There are good tutorials on this site, but check out [actionscript.org](http://actionscript.org) and [moock.org](http://moock.org) (for up to date mx tips).
