Basic Lingo

Download the sample file.  The example file is more complex than this tutorial.  I added a timer and mouse control to stop the movie, so it does not play all the time.

Bring in an image to spin.  It works best if there is an alpha channel.  Use File->Import, choose add. Click OK to everything asked.

Drag and drop the image from the Cast Window on to the Stage.


Add a behavior to the image:

Choose the image on the stage.

dir_behedit.jpg

Open the Window->Inspectors->Behavior Inspector.

Click and hold on the top
+ button to add a new behavior.   dir_behplus.jpg
         Name it   spin

In the Behavior Inspector Window, click the small arrow pointing right to see more options.   dir_r_arrow.jpg 

Click and hold on the second
+  button down  to add the command ExitFrame.

Bring up the Window->Script window

Add the following code to your spin script:

on exitFrame
      sprite(1).rotation = the mouseH
end


Hit the play arrow to see what happens.


What you did:
the mouseH is the mouse moving along the horizontal axis.  The image spins as the mouse moves horizontally.