FORUMS: list search recent posts

Start it by a mouseover

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
george hellmond
Start it by a mouseover
on Mar 23, 2010 at 10:44:10 pm


A am a very novice for Flash CS4 and AS 3.0
But I started from a complex task to make some animated picture...

What i have made:
1) imported a small picture onto scene.

2) converted it into a Symbol (movie clip)

3) created a complex Tween about 30 frames long, so that my small picture moves 3D behavior way (rotates, flyes away, and color changes during a traectory...)

All this Tween is on one layer...

ok, all I need: the motion of my object should start only when the mouse cursor gets over it.

BTW, i saw the teaching video which showed how to make the object starting moving with MOUSE_OVER. This exersise could be grait for my task if there was an explaination about HOW to make it to be applied when i already have my OWN Tween on the layer! (In that video there explained how to use some primitive Tweens that are already in the AS3.0 library)

Hoping so much on your help.

Please use very detailed explainations, step by step, if you will help me.

Please sorry for my english (UA)

Return to posts index

demetri tashie
Re: Start it by a mouseover
on Mar 24, 2010 at 1:25:52 am

hi george, it is hard to give you specific help without some additional info, but i will try to give you some information that you can use.

first- are you saying that the picture that you converted into a movieclip symbol, that inside that symbol's timeline you made your complex animation for 30 frames? let's call this case A. let's also say that you gave this symbol an instance name of 'animation_mc'.

OR, did you take that symbol, and on a main timeline then animate it from, lets say frame 1 to frame 30 ? let's call this case B.

for case A your code would look something like this:


animation_mc.addEventListener(MouseEvent.ROLL_OVER, animateMC);
function animateMC(evt:MouseEvent):void{;

where you are first telling the movie clip NOT to play, until it is rolled over.

for case B, if a movieclip symbol with the instance name 'symbol_mc' is on a frame. we'll assume it is frame 1.
then on frame 1 your code would look something like this:

symbol_mc.addEventListener(MouseEvent.ROLL_OVER, animationRun);
function animationRun(evt:MouseEvent):void{

where you are telling first the main timeline to not play, until that symbol is rolled over.

of course similar code could then be used to stop or do something else on roll-out.

hope that makes sense and helps out

Return to posts index

george hellmond
Re: Start it by a mouseover
on Mar 24, 2010 at 9:47:17 am

dear demetri!

Since I had been searching for the help with this small task for 3 days and got nothing till your post i met... I am so amazed how you caught the question and killed my problem with your strings.

So you guessed t I have designed a case B.

Of course, too lot I still don't understand - HOW does it work. Some things i understand good about doing my tweens...
But why I need to insert a new layer to put the AS code on it... we can't write AS right on that layer where Movie Clip is?...

Again, I searched a lot in the helps, in video lessons to dig deaper inside Flash but there is a lack of clearly designed tutorials exactly FOR VERY beginners. Some professionals, when make an explaination for particular things, forget to explain some termins... some words in very etail, because they count - this is what is very clear enough already for all, no sense to explain..
So, mostly, all the tutorials are good for those who have already some foundamental knowledge, and, when reads, just confirms what he knew.

I'm so thankfull for you help!!!
step by step will manage with this


Return to posts index

demetri tashie
Re: Start it by a mouseover
on Mar 24, 2010 at 10:30:09 pm

hi george,

i am so glad if this helped you out.

being a complete beginner, it is necesary to get some of the Flash basics understood before you can proceed to more complex projects.

i do strongly suggest reading and working with some of the good Flash and Actionscript books out there.Also take advantage of tutorials here on Creative Cow, as well as some other good sites. , a subscription site that also has many free tutuorials, has several series geared to a very first time user, that will teach you all the basics.

it would be hard to write a complete tutorial geared to a first time user. best to build your understanding one building block at a time. i can and will explain my code and how it related to what i believe is on your timeline. but how much of a beginner are you? do you understand how to work with a timeline? how to navigate a timeline? how to write some basic code? these amongst many other questions would need to be answered. ....

a timeline will play from frame one to the end, and then loop back and start again at frame 1 and keep looping again and again unless we tell it with code to do something else.

from your description, you made an animation, or a tween from a symbol on frame 1 and made it 30 frames long. i do not know if your timeline extends beyond those 30 frames. i will assume not. so, to keep your animation from just playing over and over and over, we write what is called a 'stop action' on the first frame.

(as a rank beginner, it would serve you better in the long run to forget about learning old fashioned timeline based animation and projects, and learn up to date OOP ( Object Oriented Programming) using Document Class, right from the beginning. but i digress ......)

even with timeline based projects, it is always best to keep all of your actionscript code in one place. that should be on the first fame of the project. best practice tells us to keep it in its own layer, usually the uppermost layer of the project. it does not HAVE to be on its own layer, but it is strongly recommended.

to get back to the explanation. your goal is to not have the animation play until you mouse over the symbol, so we need to tell the timeline not to play past frame 1. that is why we have the stop action ( the code wriiten stop(); ) on the first frame.

next you have to begin to understand the concept of event listeners, and functions. functions are the code written to tell something(s) to do something(s)

event listeners are written to tell something to recognize when something else has happened.

in our case, since we want the animation to play when the mouse rolls over the movieclip symbol, in code we need to tell the movieclip symbol to 'listen'/recognize when the mouse is over it, and then to allow for the timeline to continue playing, so we can see the animation/tween.

so we are adding an event listner to the movieclip symbol to listen for the mouse rolling over it, and then to allow a function to occur.

in our code we can name our function almost anything we want. i choose to call it 'animationRun;

all the function says is: timeline play. in code that is written as play();

i hope that helps some more. i added code hints to help you also

stop(); // tells the main timeline to not play
symbol_mc.addEventListener(MouseEvent.ROLL_OVER, animationRun);
//the above line has the movieclip recognize the mouse rollover
function animationRun(evt:MouseEvent):void{ // this declares the function
play(); // this tells the main timeline to play
// closes the function

Return to posts index

george hellmond
Re: Start it by a mouseover
on Mar 24, 2010 at 6:16:48 pm


Return to posts index

Visalakshi Radhakrishnan
Re: Start it by a mouseover
on Nov 4, 2011 at 8:09:46 pm

Thank you so much, Demetri, for the wonderful explanation.

I am a complete newbie to Flash and have been struggling for the past couple of days to stop my movie clip on mouse-over.

I saw this post and I was able to make it work in just a few minutes.

Thanks once again,

Return to posts index

demetri tashie
Re: Start it by a mouseover
on Nov 4, 2011 at 8:43:28 pm

your welcome. glad it helped.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved