Rollover

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.

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.

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.

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.

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

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:

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

hope this helps :slight_smile:

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

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 :slight_smile:

hope this helps you (-:

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

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 :wink:

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 :slight_smile:

HUH?!
scotland > england.

:slight_smile: