# Rollover

**URL:** <https://forum.kirupa.com/t/rollover/64265>\
**Category:** Uncategorized\
**Created:** [September 14, 2004, 5:29pm UTC](https://forum.kirupa.com/t/rollover/64265 "2004-09-14T17:29:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gumby19](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gumby19](https://forum.kirupa.com/u/Gumby19)\
**Post date:** [September 14, 2004, 5:29pm UTC](https://forum.kirupa.com/t/rollover/64265/1 "2004-09-14T17:29:41Z")

</div>

Is there a way to determine how long someone has the mouse over a certain button? I have a button, and if the viewer has their mouse over it for x amount of seconds, I would like there to be a pop up that says “click here”. I know I could just put a movie in the rollover state of the button and just have the “click here” show up after so many frames, just wondering if there is an easier way. Thanks.

---

<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 14, 2004, 8:51pm UTC](https://forum.kirupa.com/t/rollover/64265/2 "2004-09-14T20:51:03Z")

</div>

I would say use a “setInterval” command - Something like:

function check()  
if (cursor.\_x==button.\_x){textfield.text=“click here”  
}

setInterval(check,15000);

To get some checkage going on every 15 seconds.

You would have to use all of this in a rollOver function for you button.

Hope this helps.

---

<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 15, 2004, 9:21am UTC](https://forum.kirupa.com/t/rollover/64265/3 "2004-09-15T09:21:41Z")

</div>

Sorry that was late last night I wrote the above - If you are already in rollOver mode of course your \_x properties will be the same.

Just alter the above to:

function check() {textfield.text=“click here”  
}

setInterval(check,15000);

Hope this helps.

---

<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 15, 2004, 12:37pm UTC](https://forum.kirupa.com/t/rollover/64265/4 "2004-09-15T12:37:16Z")

</div>

That works great. How do I clear it? I tried a couple of things:

I tried the removeTextField() function and also the clearInterval function. The removeTextField kinda worked, but not really, and the clearInterval wouldn’t work at all. Any suggestions? Thanks in advance.

---

<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 15, 2004, 3:45pm UTC](https://forum.kirupa.com/t/rollover/64265/5 "2004-09-15T15:45:07Z")

</div>

i would suggest something like this:  
make a new movieclip, and then add this source to it:

```auto
onClipEvent(enterFrame) {
    if (mouseOver) {
        count++; //this will add 1 to the count variable for every frame that the mouse is over the movieclip;
        trace(count);
    }
}

```

and then, put that movieclip in a button, give the movieclip an instance name, for this example i’ll call it _movie1_

then, give the button this code:

```auto
on(rollOver) {
    this.*movie1*.mouseOver = true;
}
on(rollOut) {
    this.*movie1*.mouseOver = false;
}

```

hope this helps 🙂

---

<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 15, 2004, 3:48pm UTC](https://forum.kirupa.com/t/rollover/64265/6 "2004-09-15T15:48:20Z")

</div>

OR… and this is the simplist way of doing it i’d say:  
add this code to your movieclip:

```auto
onClipEvent(enterFrame) {
    if(hitTest(_root._xmouse, _root._ymouse, true)) {
        count++;
        trace(count);
        if (count >= *numberOfFrames*) {
            //actions when count is greater than a set number of frames
        } else {
            // ... otherwise do this code here
    } else {
        count = 0; //this resets the count variable when the mouse is not over the movieclip
    }
}

```

just remember to replace the words in _italics_ with what you’re wanting 🙂

hope this helps you (-:

---

<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 15, 2004, 4:19pm UTC](https://forum.kirupa.com/t/rollover/64265/7 "2004-09-15T16:19:52Z")

</div>

Thanks guys, I’ll try those out and see which one I have the most luck with. Thanks again.

---

<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 16, 2004, 5:06am UTC](https://forum.kirupa.com/t/rollover/64265/8 "2004-09-16T05:06:43Z")

</div>

I would say Sir cyberathlete’s solution was a lot more efficient, however if you did want to stick with my solution, & in answer to your question:

Delete the text field on rollOut I think this can be done in AS or just set “textfield.text=”"", for the same event.

---

<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 16, 2004, 4:11pm UTC](https://forum.kirupa.com/t/rollover/64265/9 "2004-09-16T16:11:48Z")

</div>

> [@Pup 100](#):
>
> I would say Sir cyberathlete’s solution was a lot more efficient, however if you did want to stick with my solution, & in answer to your question:
> 
> Delete the text field on rollOut I think this can be done in AS or just set “textfield.text=”“”, for the same event.

SIR!!! i think i could get to like you 😉

---

<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 16, 2004, 6:14pm UTC](https://forum.kirupa.com/t/rollover/64265/10 "2004-09-16T18:14:19Z")

</div>

I didn’t know it that Monika might offend cyber as you are North of the border & I believe the peerage system is a Sasanac institution 🙂

---

<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 16, 2004, 7:45pm UTC](https://forum.kirupa.com/t/rollover/64265/11 "2004-09-16T19:45:33Z")

</div>

HUH?!  
scotland \> england.

---

<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 17, 2004, 8:56am UTC](https://forum.kirupa.com/t/rollover/64265/12 "2004-09-17T08:56:14Z")

</div>

🙂
