Flash Button Animated "Over" state...

  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 27th, 2005, 2:14 pm

How do I make an animated flash button that goes both "in" and out? I can get the button on the "over" state to "Light up" but not to "unlight" after the mouse has been moved off.
I have tried to use an "Invisible" button (which is halfway through the "over" animation. With only the "hit" state) but I don't like this, and it's not as effective as I'd like it to be...
Is there an easier way? (did that make sense?)
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 27th, 2005, 2:14 pm

  • R.L.D.
  • Student
  • Student
  • User avatar
  • Joined: Apr 07, 2005
  • Posts: 83
  • Loc: Astoria,Queens
  • Status: Offline

Post April 27th, 2005, 4:45 pm

what you're trying to do works better if you use a movieClip ..
create a movie clip with the animation you want going one way..
put (stop();) scripts on the first and last frames of your animation..
then go back to your scene , click on your movieClip and put this on the action panel ::

Code: [ Select ]
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 (this._currentframe<this._totalframes) {

// keep playing the next frame to the last and stop...
this.nextFrame();
        }
// if the mouse is NOT over the clip
    } else {

// if we're past the first frame of the tween...
if (this._currentframe>1) {

// play the previous frame until it reaches frame 1 and stop...
this.prevFrame();
}
}
}
  1. onClipEvent (enterFrame) {
  2. // if the mouse IS over the clip ...
  3. if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
  4. // if the last frame of the tween hasn't been reached...
  5. if (this._currentframe<this._totalframes) {
  6. // keep playing the next frame to the last and stop...
  7. this.nextFrame();
  8.         }
  9. // if the mouse is NOT over the clip
  10.     } else {
  11. // if we're past the first frame of the tween...
  12. if (this._currentframe>1) {
  13. // play the previous frame until it reaches frame 1 and stop...
  14. this.prevFrame();
  15. }
  16. }
  17. }


give it a try :)
  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Joined: Oct 12, 2004
  • Posts: 861
  • Loc: BKNY
  • Status: Offline

Post April 27th, 2005, 6:44 pm

that's my fav transition, too...
so, just for posterity, here's my steez... first off, there's room for some kind of action on the button... also i've never had problems with leaving off the script that checks if it's at the first or last frames, 'cos it just seems to stop itself.

Code: [ Select ]
onClipEvent (enterFrame) {
this.onRelease = function(){
//    put whatever action you want applied to the button here
//    for instance:
     _root.gotoAndPlay("action");}
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
  1. onClipEvent (enterFrame) {
  2. this.onRelease = function(){
  3. //    put whatever action you want applied to the button here
  4. //    for instance:
  5.      _root.gotoAndPlay("action");}
  6. if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
  7. this.nextFrame();
  8. } else {
  9. this.prevFrame();
  10. }
  11. }


peace.
  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 28th, 2005, 12:47 pm

R.L.D. wrote:
what you're trying to do works better if you use a movieClip ..
create a movie clip with the animation you want going one way..
put (stop();) scripts on the first and last frames of your animation..
then go back to your scene , click on your movieClip and put this on the action panel ::

Code: [ Select ]
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 (this._currentframe<this._totalframes) {

// keep playing the next frame to the last and stop...
this.nextFrame();
        }
// if the mouse is NOT over the clip
    } else {

// if we're past the first frame of the tween...
if (this._currentframe>1) {

// play the previous frame until it reaches frame 1 and stop...
this.prevFrame();
}
}
}
  1. onClipEvent (enterFrame) {
  2. // if the mouse IS over the clip ...
  3. if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
  4. // if the last frame of the tween hasn't been reached...
  5. if (this._currentframe<this._totalframes) {
  6. // keep playing the next frame to the last and stop...
  7. this.nextFrame();
  8.         }
  9. // if the mouse is NOT over the clip
  10.     } else {
  11. // if we're past the first frame of the tween...
  12. if (this._currentframe>1) {
  13. // play the previous frame until it reaches frame 1 and stop...
  14. this.prevFrame();
  15. }
  16. }
  17. }


give it a try :)

Do I make a button first and then put the mc inside?
or do I just make a movie clip of the action??
  • R.L.D.
  • Student
  • Student
  • User avatar
  • Joined: Apr 07, 2005
  • Posts: 83
  • Loc: Astoria,Queens
  • Status: Offline

Post April 28th, 2005, 1:06 pm

add a layer in the movieClip and make a rectangle to be used as the button.. convert it to a button and make sure you clear all frames exept for the "hit" frame on the button timeline ..
the button its going to look green ,, but when you test your movie you wont see it .

in other words .. yea .. make a movie clip of the action you want .. inside the movie clip .. do that i wrote above.
  • R.L.D.
  • Student
  • Student
  • User avatar
  • Joined: Apr 07, 2005
  • Posts: 83
  • Loc: Astoria,Queens
  • Status: Offline

Post April 28th, 2005, 1:15 pm

go here and download their sample .fla

http://www.advanceflash.com/#sec=1&cat= ... z=1&sizn=1

or

http://www.advanceflash.com
  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 28th, 2005, 1:20 pm

Ok... I want it to stop halfway through and continue when the mouse rolls off...
How do I do that?
  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 28th, 2005, 1:58 pm

R.L.D. wrote:
go here and download their sample .fla

http://www.advanceflash.com/#sec=1&cat= ... z=1&sizn=1

or

http://www.advanceflash.com


Thanks! This helped.
  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 28th, 2005, 2:21 pm

Yes! I have every thing done! I just need a hit area now! How do I add a hit area over my movie clip???
  • kevsterb007
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Apr 27, 2005
  • Posts: 145
  • Status: Offline

Post April 28th, 2005, 3:14 pm

I added the invisible button just like you said. It isn't working!

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 40 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.