PDA

View Full Version : Flawless Rollover Button


djpacmansd
11-17-2005, 11:54 PM
Hello, Noob here, 1st post yada yada,

Okay. Here's my problem. I have a movie clip button that animates an expanding bar that shoots our to the right. Kinda like it's sliding out, on rollover. On rollout it retracts. Now my problem is this. Sometimes if I move the mouse cursor over and out of it too fast it will get stuck. I then have to mouse over again to have it retract.

Is this some kind of glitch or bug in flash mx 2004? If anyone can tell me how to fix this problem please let me know.

Pretty much I have an expanding animati0n and a retracting one. How do I code it so it doesn't get stuck when I rollover/out too fast.

Also another question here. Lets just say the button just expands out, is there a script that would make the button play my expanding bar animation backwards. In other words have it retract be reversing the timeline on rollout. That way I don't have to create a "retract" animation in the time line. Any help would be greatly appreciated from this Noob of noobs. peace

arkanoid2k
11-18-2005, 12:24 AM
it sounds like your FPS are too low...or at least not so fast as you would like. try publishing your work with a greatter frame rate.

for the second part of your question you should try some research on the MovieClip() Class...

steven lyons
11-19-2005, 09:05 PM
question 2:
Basically you want an onEnterFrame function for the clip that needs to be reversible and then trigger it to play forward or backward based on a flag variable that you set to true or false by rolling over a button.

for the clip you want to reverse:


my_clip.onEnterFrame = function() {
if (_root.over==true) {
this.nextFrame();
} else {
this.prevFrame();
}
};


for the button which will trigger the animation via a rollover:


btn1.onRollOver = function() {
_root.over = true;
};
btn1.onRollOut = function() {
_root.over = false;
};

oldnewbie
11-19-2005, 09:28 PM
Use a button movie clip along with a hitTest instead...

You should get the idea...

rio80
11-25-2005, 11:23 AM
Use a button movie clip along with a hitTest instead...

You should get the idea...

i'm using your source oldnewbie and works great!!!

I'd like to know if it's possible to specify an area of the movie clip that will be active! eg. in your source let's say that just half of the movie clip would work as active area for the rollover/rollout! It is possibile?

Betoranaldi
01-04-2006, 02:46 AM
Is it possible to use this and on enter frame control a different movieclip (with a different instance name?

Betoranaldi
01-04-2006, 04:10 AM
Got it to work...


onClipEvent (enterFrame) {
// if the mouse IS over the clip ...
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
// if the last frame of the tween hasn't been reached...
if (_root.MCinstanceName._currentframe < _root.MCinstanceName._totalframes) {
// keep playing the next frame to the last and stop...
_root. MCinstanceName.nextFrame();
}
// if the mouse is NOT over the clip
} else {
// if we're past the first frame of the tween...
if (_root.MCinstanceName._currentframe > 1) {
// play the previous frame until it reaches frame 1 and stop...
_root.MCinstanceName.prevFrame();
}
}
}