|
||||||
|
||||||
Click by Click: Flash
- Sliding Menus
Moving an Object on Roll
Over using ActionScript
Full Version: This is a shortened click by click version of a: Full Length Tutorial
Free
Flash Tutorial
![]()
In this tutorial you will learn how to make things slide on and off the Stage. This could be used to slide Menus on and off. It could also be used to slide photos, forms, animations or any other objects. In fact you can use it to move multiple objects on and off screen all at the same time. Some can come from the top or bottom whilst other can slide in and out from from the sides.
My Example: Download the Flash file Int 101a
In
this example I have used four positions for the Movie Clip.
Step
One: Setting Up the Document
Important: This click by click is designed for Flash CS3 or F8. For Flash: MX04 / MX / 5. For the full tutorial: CS3 / F8
Step Two: Creating the Movie's Content
Step Three: Place the Movie Clip on the Stage
Step
Four: Frame 1 Actions
yTargetMC = 100;
Step
Five: Movie Clip Actions
onClipEvent (enterFrame) {
yMC = getProperty(_root.MC, _y);
moveMC = _root.yTargetMC - yMC;
setProperty(_root.MC, _y, yMC + (moveMC/10));
}
Step
Six: Test the Movie
If everything is correct the menu should now slide in as the movie loads. You
may want to check that the stop point and speed are correct.
Step Seven: Placing a Button on Stage
The last thing is to place a button on Stage and set the ActionScript so that the Movie Clip moves when you roll over or click the button. You will either need to either create a new button and place it on Stage or drag a button out of the common button library. Either:
My Button:
on (rollOver) {
yTargetMC = 200;
}Note: The target number must be different to the number in frame 1 otherwise the Movie Clip will not move. Change the target number to a number that suits the position that you want the Movie Clip to stop at.
As an alternative make the Movie Clip move on (release) like this:
on (release) {
yTargetMC = 200;
}
I created one more button:
on (release) {
yTargetMC = -600;
}
I hope you have found this useful. If so perhaps you could recommend this site to others and link to webwasp!
This is a quick reference version of a full length tutorial: Full Length Tutorial
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
4500 visitors to this page since
6 June 07 •
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|