# Flash Can't Reach The Button

**URL:** <https://forum.kirupa.com/t/flash-cant-reach-the-button/262813>\
**Category:** flash\
**Created:** [June 10, 2008, 6:14am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813 "2008-06-10T06:14:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 10, 2008, 6:14am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/1 "2008-06-10T06:14:33Z")

</div>

I’m experiencing a problem with my inventory system. I have a inventory that will hide/show itself whenever the mouse is over it. And inside “inventory”, I have a couple of slots that should trace “Pres” whenever I click on them. Problem is, it doesn’t. I think it has something to do with my inventory hide/show code because when I took it out, everything worked. Heres the code for the inventory:

```auto
//This is so that it stays in one spot when the movie loads.
onClipEvent (load) {
    yMove = _y;
    easeSpeed = 5;
}
onClipEvent (enterFrame) {
    _y += (yMove-_y)/easeSpeed;
}

on (rollOver) {
    _root.inventory.yMove = 96.8
}

on(rollOut) {
    this.yMove = -42
}

```

Any hints?

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [June 10, 2008, 6:20am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/2 "2008-06-10T06:20:10Z")

</div>

i guess you are writing code inside the MC. Congrat, you will have to make 200% extra time editing the code. And you will have about 400% more syntaxes.

onClipEvent = Movieclips only  
on = buttons only

But, this could be made in root:  
clip.onEnterFrame ()  
clip.onPress  
clip.rollOver  
clip.rollOut

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 11, 2008, 1:19am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/3 "2008-06-11T01:19:53Z")

</div>

Yes, I put the trace code on the “slot” mc thats inside the inventory MC. But I did that b4 in another project and it worked…both my inventory and slot are all MCs. What should I do?

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 12, 2008, 3:25am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/4 "2008-06-12T03:25:57Z")

</div>

Anyone? Some help?

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [June 12, 2008, 7:17am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/5 "2008-06-12T07:17:20Z")

</div>

have all action script in frame 1.  
then you can target the mcs with functions more easly:  
target.subtarget.onRollOver etc etc

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 12, 2008, 12:26pm UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/6 "2008-06-12T12:26:24Z")

</div>

yes, I tried that already didn’t work either. Although I tried doing onMouseDown + if(mouse hittests target) which is basically the same thing as onPress and THAT worked. Should I keep using that or find a way to make the onPress work?

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 12, 2008, 12:42pm UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/7 "2008-06-12T12:42:02Z")

</div>

erm post the fla it can’t be that hard…

if you are running cs3 give up now lol

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 13, 2008, 2:14am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/8 "2008-06-13T02:14:24Z")

</div>

Ok, heres the .fla and swf:

SWF

[http://spamtheweb.com/ul/upload/130608/36782\_Untitled-1.php](http://spamtheweb.com/ul/upload/130608/36782_Untitled-1.php)

FLA

**[http://spamtheweb.com/ul/upload/130608/36830\_Untitled-1.fla](http://spamtheweb.com/ul/upload/130608/36830_Untitled-1.fla)**

---

<div class="post-metadata">

**Author:** ![Adam1](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Adam1](https://forum.kirupa.com/u/Adam1)\
**Post date:** [June 13, 2008, 4:23am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/9 "2008-06-13T04:23:18Z")

</div>

If you take out the "My Dad == " on your buttons, you can trace “fianlly” which is what I think you’re looking for, no?

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 13, 2008, 6:14am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/10 "2008-06-13T06:14:15Z")

</div>

no No no, that was just a accident. I want to make the onPress work instead of hittest+mouseDown. Is there any way to do that?

---

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [June 13, 2008, 10:06am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/11 "2008-06-13T10:06:34Z")

</div>

And here’s a pretty simple inventory of mine:  
[http://www.n99creations.com/vieweg.php?id=19](http://www.n99creations.com/vieweg.php?id=19)

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 13, 2008, 3:04pm UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/12 "2008-06-13T15:04:52Z")

</div>

Mind if you post the .fla for me? I don’t want to through a whole registration process just to be able to download the file.

---

<div class="post-metadata">

**Author:** ![Captain\_Ahab](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@Captain\_Ahab](https://forum.kirupa.com/u/Captain_Ahab)\
**Post date:** [June 15, 2008, 2:22pm UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/13 "2008-06-15T14:22:29Z")

</div>

I had the same problem.  
What I did was giving up on the target.onRollOver = function, and replaced it with a listener inside (yep Macsy, inside 😉 ) the menu\_mc (the mc that supposed to show/hide itself) that checked if the mouse was in the area of my menu, and placed the action for the buttons on frame 1 of my script.

tell me if you want to see the code.

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 16, 2008, 12:41am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/14 "2008-06-16T00:41:02Z")

</div>

Yes, please, post the code but also post some links to KeyListener tutorials, as I really want to learn and not just copy and paste 😃

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 17, 2008, 12:38am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/15 "2008-06-17T00:38:11Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 18, 2008, 2:46am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/16 "2008-06-18T02:46:39Z")

</div>

Bump…

---

<div class="post-metadata">

**Author:** ![bnns](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bnns](https://forum.kirupa.com/u/bnns)\
**Post date:** [June 18, 2008, 6:12am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/17 "2008-06-18T06:12:47Z")

</div>

wait you want it to trace what??? “finally”?

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 18, 2008, 7:29am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/18 "2008-06-18T07:29:51Z")

</div>

thats just for testing…I’m gonna switch the trace code to something else once it works.

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 18, 2008, 8:51am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/19 "2008-06-18T08:51:22Z")

</div>

```auto
 
/*
inventory.onRollOver = function() {
 //trace(_root.yMove);
 _root.yMove = 96.8;
};
inventory.onRollOut = function() {
 yMove = -42;
};
*/

```

you need to engineer the inventory box to move in reference on where the mouse is.

By using rollover commands you turn the entire box into a button, buttons within a button don’t work!!!

**for example have code which calculates the area the inventory box is taking up**

if mouse is within this area, set yMove =98.8 else yMove =-42

that means no hit tests either.

it looks promising graphics wise

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [June 19, 2008, 12:20am UTC](https://forum.kirupa.com/t/flash-cant-reach-the-button/262813/20 "2008-06-19T00:20:53Z")

</div>

Thank you, I will try that immediately. The graphics for the new game are cominga along great, I’ll post up a demo in no time =).
