## Introduction: Cat Chasing Sausage (Adobe Flash Actionscript Animation)

Hi!

In this instructable of mine I'll share with you some simple, fun codes with actionscript 2.0 to make anything follow your mouse. I'll attach the example file (.swf file) as well as the original flash file (.fla file) so you can play around with it. We need Adobe Flash any version that supports actionscript 2.0 and Flash Player version 9.0 or higher. If you have a website or blog, you can embed it onto in for fun with your own ideas and images.

## Step 1: There's Short Note on EACH Image. Follow the Right Order :)

## Step 2: Follow Short Notes on Images.

## Step 3: Very Short

## Step 4: Copy All

setProperty("", _quality, "MEDIUM");

N = 20;

R = 12;

C = 2;

A = 2;

var x = new Array();

var y = new Array();

for (i = 0; i < N; i++)

{

x[i] = 0;

y[i] = 0;

} // end of for

for (i = 1; i < N; i++)

{

if (i == 1)

{

attachMovie("three", "Pieza" + i, N + 1 - i);

}

else if (i == 4 || i == 14)

{

attachMovie("two", "Pieza" + i, N + 1 - i);

}

else

{

attachMovie("one", "Pieza" + i, N + 1 - i);

} // end else if

this["Pieza" + i]._x = 142 + x[i - 1];

this["Pieza" + i]._y = 142 + y[i - 1];

this["Pieza" + i]._xscale = 102 + A * (1 - i);

this["Pieza" + i]._yscale = 102 + A * (1 - i);

this["Pieza" + i]._alpha = 100 - 100 / N * i;

} // end of for

## Step 5: Copy All

x[0] = x[0] + (_xmouse - x[0] - 142) / R;

y[0] = y[0] + (_ymouse - y[0] - 142) / R;

for (i = 1; i < N; i++)

{

x[i] = x[i] + (x[i - 1] - x[i]) / C;

y[i] = y[i] + (y[i - 1] - y[i]) / C;

} // end of for

for (i = 1; i < N; i++)

{

this["Pieza" + i]._x = 142 + (x[i - 1] + x[i]) / 2;

this["Pieza" + i]._y = 142 + (y[i - 1] + y[i]) / 2;

this["Pieza" + i]._rotation = 5.729578E+001 * Math.atan2(y[i] - y[i - 1], x[i] - x[i - 1]);

} // end of for

## Step 6: Copy All. to Test, Hit Ctrl + Enter

gotoAndPlay(2);

## Step 7: The Sausage. Done.

cursor_mc.startDrag("true");

Mouse.hide();

## Step 8: Optional. Do This If You Want to Send It to Someone.

Sorry if it's too long. Thank you for following it to the end.

## Step 9:

## Share

## Recommendations

We have a **be nice** policy.

Please be positive and constructive.

## 2 Comments

Interesting, thanks!

Thank you!