Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Animation on mouseover

Status
Not open for further replies.

clophon

Technical User
Feb 7, 2002
4
US
i'm new to flash, in fact i just created my first animation tonight for my website. i set it up to play a short movie (about 15 frames just as the page loads) that fades in the title of my site. i also set up an animation right after it (on the same movie) in which the letters burst out and fade back to white. I would really like to know if i can make that second part of the animation (and only the second part) play when someone runs the mouse over the movie? i can't figure it out.
 
There are a few ways to do this but here's the easiest (don't know how familiar you are with the program so I'll go into more detail than you may need ;-) ).

In your animation you'll need to put a stop() action on a frame after the fade in but before the burst apart. When your movie plays you'll get the fade as before but it won't go on to the second phase. Then put an invisible button in a layer above your animation which covers the text completely.

(If you don't know how to do this just create a button as normal but delete all the content in it except for the shape in the "hit" frame - it should show as a semi-transparent blue shape when you drag it on to the stage.)

Give your animation movieclip an instance name (I'll use "animation" for now - the dialog to use is labelled "instance").

Add these actions to your button...

on(rollOver){
animation.play();
}


Should do it...
 
ok i created the stop frame, the instance of the "burst" clip, and the button, but i'm having trouble assigning the play function to the button. when i right click on it an enter properties there isno where to assgn the button to play an instance of my animation. how should i go about elling it to play that clip?
 
Right-clik the button on stage. Select Actions. Object actions window will open. In the list on the left, double-click the on action. Select the state you want your movie clip to start playing... press, release, rollover or whatever. Next switch to Expert Mode by selecting it in the top-right arrow menu of that Object actions window. Set the cursor before the second "}", and type in _root.animation.play();

Switch back to normal mode (in that top-right arrow menu), close the window and test your movie. Make sure you've named the instance of your burst movie clip, as animation.


Regards,
new.gif
 
i'm having trouble getting either of those coodes to work. i could get it to play the rest of the movieby just tell thing the button to "play()" on mouse over. is there some way to set up another action like i did the "stop()" action that would rewind to the the frame that i put the "stop()" action and then it would theoretically loop on mouseover?

or, what could i be doing wrong with what i am currently trying to do? the "burst" clip is saved as a symbol called "animation" do i have to do anything special to it after i added it to the library?

thank you so very much,
clophon
 
I misunderstood your question first time round - I thought there was only one animation which faded at first and then burst apart. If you have two separate clips then things are slightly different (but not any more complicated).

If you want to create a looping animation on mouseover use the button script as before but place this in it instead of the play() action:

gotoAndPlay(1);//(or whatever frame your animation starts at).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top