O.K, I'm not sure if you have as3 or not, but I knew as2 at one point.... If you don't have as3, I'll figure it out (how to make it in as2). However, when I started learning as3, I forgot as2...
Anyway.... here's how to make it:
1. Create a new doc (as3)
2. Create the movieclips (lightsaber blade and lightsaber hilt)
3. Create 2 more layers (to have 3 total)
4. On the first layer, put nothing (this is where the actionscript will be)
5. On the second layer, put the lightsaber hilt (instance name ls_handle)
6. On the last layer, put the lightsaber blade (instance name ls_blade)
7. Go to the actions layer (top layer. Make the layer name actions if you want, but keep in mind I will always refer to is as the actions layer)
8. Put in this code:
ls_handle.addEventListener(MouseEvent.MOUSE_DOWN, bladeOut);
function bladeOut(event:MouseEvent) {
ls_blade.play();
}
ls_handle.buttonMode = true;
Now, here's what the code means:
1st line: This is creating the event listener (hence addEventListener). Putting ls_handle (the lightsaber hilt instance name) in front of it means, in this case (since it's a mouse event), that if you click on that (and only that), it will open and close the lightsaber hilt. And now, inside the ()'s. The event type is a mouse event (hence MouseEvent), and the event will be triggered when you click (hence .CLICK). The function name is bladeOut(hence bladeOut);
Line 3: This is creating the function bladeOut. You put the:
(event:MouseEvent)
in there to show that it is a mouse event, in case you have another event with the same name.
Line 4: This is triggering the animation (We haven't created it yet)
Line 5: This closes the event.
Step 9: Go inside the lightsaber movie clip, and create an animation of it going up and down. In the first frame, go into the actions panel, and type:
stop();
Type that in the 15th frame action panel as well.
Step 10: Done!
http://up2share.com/view/imfbwdgju