'Hit' State on a Movie Clip

I’ve come into a situation where I cannot use a normal button. Instead I must make a Movie Clip which acts as if it was a button.

If anyone can explain how to make, at least, the ‘Hit’ state… It would be muchly appreciated.

Thanx in advance!

Howdy.

Beware of cross-posting. It makes the moderators mad.

Up = frame one movieclip, as is
Over = frame two MC, onRollOver
Hit = frame three MC, onClick
Down = frame four MC, do something

Why bother with the Hit state? No one ever really sees it anyway as most computers blip past it so quickly these days . . .

Thanx again for the advice.

One comment,… Isn’t the ‘Hit’ State necessary for the MC to act as an actual button? EG: Cursor change on Rollover

Not at all. Even when you are using an actual button instead of an MC you don’t have to fill ALL the states. You don’t have to fill ANY of them. You just have to give it some action so that when the user hits the button it does something. Otherwise why have one? So all you need in your case is either an onRollOver/onMouseOver or an onHit/Click/MouseDown etc. whichever you prefer (or both if you are going for special effects).

:smirk:

Boom! You’re the man!

Thanx a lot,… Let me know if you ever need a favour

One more problem,… My Movieclip does not seem to be registering the Rollover and Rollouts very well. It often doesn’t notice that It rolls out and then when I roll back over it plays the Rollout animation. Any Ideas?

What is it exactly that you are trying to do on those states?

rollOver - Graphic fades in
rollOut - Graphic fades Out

I’ve noticed a pattern in which when I rollOver the first time it works perfectly. When i rollOut the first time It works perfectly as well,… However, When I rollOver and rollOut again,… It reverses the rollOver animation with the rollOut animation. Vice Versa

Here is a ScreenCap of my timeline,… Frame 2 is rollOver animation,… Frame 9 is rollOut animation.

You could try a hit test with the mouse (_xmouse, _ymouse) to fade in, else fade out.

How do you have your fade? When I’ve done that in the past I have both tweens on one layer. In other words, fade in is frame 1-20, frame 21 is just a stop, 22-40 is fade out. Then onrollOver I would gotoAndPlay(1) and onRollOut gotoAndPlay(22) - and make sure there is a stop on frame 40 as well.

You might want to put all of this in an onClipEvent handler too, with a delete this.onEnterFrame() at the end. Voetsjoeba helped me out with something simliar at this thread:

http://www.kirupaforum.com/forums/showthread.php?threadid=35868

(scroll to bottom).

Oops, looks like we posted at the same time LOL!

I’m at work right now and no Flash :d: but if you can’t figure it out and no one else jumps in I can help you out when I get home in about 5 hours . . .

The reason im responding so fast is that this project im working on is do within 5 hours! :wink:

I’ve never seen a problem with rollOvers not registering properly.
Im very lost on what the resolution to this problem could be.

Try the hit test then. It returns a boolean which you can then use to do whatever from there (if false do this if true do that). If you can’t figure it out from the reference in flash then do a search in the forums. There are a lot of threads on that. Also, check the thread I gave you with the AS by Voets (genius, pure genius). It worked perfectly for me!

I did happen to check out the solution to your problem, however, I cannot find a way to relate it to mine. Maybe Im just slow today. But yeah,… Im using MX Pro and was wondering if you could maybe write out a quick syntax for the hitTest in my situation.

Thanx again!

Well, I have no idea how this will work, since I have no way of testing it, but try putting this on your main timeline:

this.onEnterFrame = function() {
if (yourMC.hitTest(_xmouse, _ymouse)) {
_root.yourMC.trainIn.gotoAndPlay(1);
delete this.onEnterFrame;
}
};

Hopefully it’ll work . . . :wink:

Hey looky looky! This should help you out . . .

http://www.kirupaforum.com/forums/showthread.php?threadid=37455

See? I told you Voets was awesome! Shhh . . . don’t tell anyone but he’s my hero!

=)

Nothing!

:stunned:

Hmmm,… I must be doing something wrong,… Or the Hierarchy of my timeline is just way to complex that im not doing something right

This is starting to become very frustrating,… 4 Hours to deadline

Check for silly mistakes like spelling of instance names and where they are located (e.g. # of parents or _root etc).

Checked everything,… Nothing

Correct me if im wrong,… But with that AS placed in the right place,… I should be removing my whole rollOver and rollOut animations,… Correct? You know,… The timeline screencap I attached earlier?