Skip to main content
Participant
March 30, 2012
Question

How to make an "Ignore *this* command if..." command

  • March 30, 2012
  • 1 reply
  • 832 views

I'm new to Adobe Flash and especially new to Actionscript. Could somebody give an example and explain how to make and "Ignore *this* command if..." style command. Here's what I want to achieve:

I have made a button (I may have done it in an odd way but it works) that moves when the mouse hovers over it and then moves back when the mouse moves away. I plan to put the finished product into Dreamweaver and have tried what I've done so far and it works. The problem is that if I move the mouse away before the first animation of the button has finished. It doesn't reach the *Mouse Out* command and then just sticks/stops in the bit where I have put a *stop* command.

Basically, what I want is a way to ignore a command if something happens earlier on (such as the cursor being moved away).

I've tried to explain the best I can without actually screenshotting it and copying commands.

Hope somebody understand what I'm trying to do...

Thanks in advance.

David

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
March 30, 2012

I am not sure what you mean by it not reaching the Mouse Out command,  so what does that mean?

There are ways to animate things using Actionscript such that you don't need to rely on the timeline reaching anything.

dp33600Author
Participant
March 31, 2012

Thanks for your quick reply.

By the Mouse Out command, I understand that I removing my cursor from the button before the timeline reaches the frame that I have put the Mouse Out command. This means that the button animation stops at the *stop* command instead of *gotoAndPlay(--)* because the timeline hasen't got to it yet and I've already remove my cursor. If I still haven't explained it very well, I'll try and get some snapshots of what I'm just trying to do. I'm still experimenting though so what I've done looks a little "done quickly".

If you could suggest any ways or direct me to any help on how to animate things using actionscript without needing to rely on the timeline that would be great.

Ned Murphy
Legend
March 31, 2012

You should be using ROLL_OUT or MOUSE_OUT listeners to manage triggering your mouse out behavior, such that it moves to the Mouse Out section of your timeline.

As far as using Actionscript to animate, you could look into using the built-in Tween class (and later, the third party tweening engines like TweenLite or Tweener).  What you can do with that is make it such that your mouseover starts the movement from one point to another, and when a mouseout occurs, you have it change the tween to start from where it currently is for a smoother looking transition... no need to deal with a Mouse Out frame... you just specify the starting value as the current value of that property (as in: yourMC.x)

To find help with just about any topic in Flash you should learn to rely on the Flash help documentation and Google... both valuable assets.  If you search Google using key terms that represent what you want to find, you can often find several results of exactly what you want.  In this case you could search using "AS3 Tween tutorial"  ...notice the key elements inthat search phrase... the Flash coding language, the language element, and a request for a lesson.