Thursday, August 30, 2012

Macromedia Flash Outputs


- Part 1

First thing to do is to setup the stage and layers. After we have this done, we'll move on to creating the Movie Clip (MC).
For the tutorial we'll make the Stage 400 x 300, with a fps (frames per second) of 12, which is standard. Background color can stay white.

Now for the Layers.
Default, you start with 1 layer, which is namedLayer 1.


Lets make 1 New Layer. To do this press the New Layer Button. So now we have
Layer 2
Layer 1
Rename Layer 2 to "Actions".
and Layer 1 to "Ball"
and Layer 1 to "Ball" Next, we create the MC called Ball

Select the "Ball" layer and Create a small Circle or some other type of shape.

The Select the what you created and go to 
INSERT > Convert to Symbol

see below in converting symbol
And rename it to "ball" and make sure the Movie Clip is Selected.
Then Click on OK.

With the ball MC selected, change the Instance Name to ball.

While the ball MC is still selected lets add the actionscript to it. Right Click on the ball and select Actions.

In the Top Right corner of the Actions window click on the View Options and Select "Expert Mode". Then Copy and paste the code to the right into the Actions Box.

onClipEvent (enterFrame) {
      // Sets Property of 'ball' to where the mouse is
(this, _x, _root.mousex);
(this, _y, _root.mousey);

Now, Select the first Frame for the Actionslayer, Then right click on the frame and chooseActions. Then Copy and Paste the Code to the right into the Actions box.

// Gets the current mouse pointer x and y values
// Then places them in stored varible called: mousex or mousey
_root.mousex  = getProperty(_root,_xmouse);
mousey  = getProperty(_root,_ymouse);


So, next thing is to add a 2nd frame for both of the Layers. To do this Select Frame 2 on both layers, then right click and selectInsert Frame. After that make sure only Frame 2 of Actions is selected and right click on frame 2 and select Insert Keyframe.


With Frame 2 of Actions selected place agotoAndPlay(1); action. So that once it reaches frame 2 it replays.


To the right is what your finished timeline should look like.
Press ENTER+CTRL to test the movie.

Output: oval will follow on the mouse pointer x and y axis.