OBJECT ROTATION USING AS2 as2 |
This very short and simple tutorial will show you how to rotate objects in flash using actionscript 2.0. As long as the obejct ( or more objects )
is in one movieclip, you can rotate it using this simple way to create nice looking effects for your flash movie. For example by rotating black and white hypnotic circle you can get something like this:
Open new actionscript 2.0 document. Insert new layer.Upper layer should have two one block long frames. Lower layer should have one two blocks long frame. Select the lower layer. Insert whatever object you want to rotate and
convert it to movieclip. Set the instance name of this movieclip to objekt. Now select first frame of upper layer and insert this actionscript code:
setProperty("_root.objekt",_rotation,(getProperty("_root.objekt",_rotation))+10);Now select second frame on the same layer and insert this actionscript code: gotoAndPlay(1);
Script on the first frame sets the rotaion property of this movieclip. Each time this frame loads , this script increases its angle by 10. If you want the object to rotate faster
change 10 to higher number and if you want it to rotate slower change it to smaler number then 10. If you change + to -, movieclip will rotate the other way. Script on second frame creates loop.
|