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!

Play MC effects on buttons 1

Status
Not open for further replies.

josel

Programmer
Oct 16, 2001
716
US
Greetings FLASH'ers!

I have come across a few buttons with very neat effects. I guess they play MCs. How do you do that?

I am messing around and cannot make it work. Created MC with explosion/alpha effect. Created button. Placed MC on button's down stage. Place button on stage and CTRL-ENTER

Nada! 8-(

After you are through laughting, can you please help me out?

Great, thank you guys!


josel

If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
The way you did it, it should only work when you hold your button pressed down, as it would only appear when you rolled over your button if you had put the animation on the rollover state. Mouse off the button ang bingo the clip disappears!

To have more control, you don't usually put mc on the buttons states. You create seperate elements (the button & the movie clip), dragged them both on stage, and control the movie clip from the button with Object Action scripts.

You should for instance, create your movie clip, making sure the first keyframe is blank and as a stop action on it, so that it doesn't play until you tell it to.

When you drag your clip from the library on the stage, you will thus only see a small circle to help you position it. Just set it on stage for now, besides the button, and worry about fine tuning it's position later. You'll have to allways test your movie to see this clip in action, you won't see it in action if you run the main timeline. unless you're in that clip's editing mode.

Next step is to select your movie clip (click that small circle, and in the instance panel name this instance in the name box. Name it my_clip.It can be anything you like, but that is the name you will use in the button script to control this movie.

That done, right-click your button, and select Actions. This will open up the Object Actions window in which you'll set your actionscript.

Do something simple to start with. From the actions list on the left select the on action, followed by play so you end up having something like:

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

Close the window and test your movie. Now remember your movie clip is stopped on it's first frame, but if you press the button your telling it to play, and it should.

Regards,
new.gif
 
It is always good to find out how simple it can be.

Of course, after been spoon-fed ;-)

Thanks oldnewbie!


josel If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top