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!

easy question for you experts, run movie clip on mouse click?

Status
Not open for further replies.

luckyy

Technical User
Sep 29, 2001
40
AU
I'm sure it's staring me in the face, but I can't get it to work. All I want to do is run a short movie clip on mouse click of a button, or first frame of the mclip.
Any instructions, or better still egs would be of huge help, thanks for you time, cheers luckyy
 
put these actions in your button..

on (press) {
_root.yourmc_name.gotoAndPlay("1");
}

make sure you name the instance of your mc the same as the name you are calling in your button..

ie: if the mc's name is oldnewbie.. then in return your actions would be:

on (press) {
_root.oldnewbie.gotoAndPlay("1");
}

make sure when you drag your mc into the main timeline you name it in the instance panel...
e.gif


carlsatterwhite@endangeredgraphics.com
 
oh wait i forgot..you don't have to put the " " around the frame number..only if you label the frame with a name..

see old man i get..just takes a while..

scary, is it not?
e.gif


carlsatterwhite@endangeredgraphics.com
 
You doing well Carl! Soon I won't be needed around here anymore!
mywink2.gif
ldnewbie
 
Thanks for that, the manual was getting dangerously close to the incinerator. If it's no trouble, how would you assign the same action to the first frame of the mc itself?
To make it a bit clearer, I want my scene to have a childs toy in it which run through a simple animation when the ankle-biter clicks on it, I think you get the idea,
Cheers, you guys are golden!
 
"sigh".........
e.gif


carlsatterwhite@endangeredgraphics.com
 
see, there ya go!!

e.gif


carlsatterwhite@endangeredgraphics.com
 
So is the onclip action assgined to the mclip itself? what script should be entered in the onclip event? Thanks guys the button one has become clear but assigning the action to the mclip itself, to eleviate the need for a button, has plunged me well back into the depths of confusion, cheers.
 
tell me exactly what you want the clip to do..first you have the user clicking a button and then the mc starts...then when the mc gets to a certain frame it does something else?..

e.gif


carlsatterwhite@endangeredgraphics.com
 
Sorry, I'll make it clearer. Forget the button, I want the mclip to run when the user clicks the first frame of it, ie: there will be a static graphic on the page, when it is clicked, it becomes animated. Hope that gives you a better idea, thanks...
 
Convert your graphic to a symbol, wit a button behavior.
Add this action to it:

on (press) {
_root.testmc.play();
}

Of course, there should be a stop() action on the first frame of your mc.

Regards,
mywink2.gif
ldnewbie
 
Will this work when the intial graphic is part of the movie clip (the first frame), ie it will have mc behaviour? Hopefully this is the last question, but my old dad told me not to count my chickens before they hit the fan...
 
yes it will work..what ever is in the first frame just convert it to a symbol..
e.gif


carlsatterwhite@endangeredgraphics.com
 
Will the graphic itself animate? Or if hovering over it will only start something else going in the mc?
mywink2.gif
ldnewbie
 
Thanks very much guys, its finally all going to plan, cheers, Luckky
 
Since you brught it up....;-)

Put a stop() action in frame 1 of the movie clip, select the clip on the stage and add this in the actions window...

//detect if mouse is pressed
onClipEvent (mouseDown) {
//detect if mouse is over the movieClip
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
//play the clip from frame 2
gotoAndPlay (2);
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top