Path Class
[ June 17, 2005 ] by Ivan Dembicki, aka Iv
A tutorial on the usage of the "Path" class, useful to make movieclips follow a dynamic path generated through actionscript. The class can be downloaded freely.

Let's make it look like this:

Why like this? Because we need the waves to be controlled easily. If you want to have a little stir, go ahead. After you have played enough, play it again but wisely, watching the way the wave behaves according to your actions. Think if you could program such actions yourself.
Let's see how we've come to that.


Just take the first FLA and change it a bit. First we have to change the class of the control points to our needs. We make the movie a component, assign the movies in the scene with numbers in the component properties so that they know which of them are their closest neighbours.
Second we have to change the way the line is drawn: the node points are calculated (they will be inbetween the movies) and all our movies become controls. Also they are made invisible.
We add more points and in the end we get this funny little rope: pull this wire as much as you like. :)

[Download the source FLA]


Let's experiment a bit with the end points. I will give them random coordinates to see what happens:

[Download the source FLA]

Not exactly what we were looking for but nevertheless it is not a reason not to root through the FLA and go over to the next step of the plan.


I took the readymade ship from the previous page and put it into the root. It is not over yet: in the place where goes the rendering section I added array point collection into path_array. This array is feeds the getPoint method of Path class in the ship. This evidently demonstrates that for this method it makes no difference what to use: a set of given coordinates or an array are equally usable. Have a look at the FLA and mess with the ship:

[Download the source FLA]

Still these waves look a bit dissapointing as they don't look like waves really...


Now, to make these waves look like waves is not a big deal. Anyway, I am quite sure that my solution is not the only of a kind and obviously not the best. Have a look at the FLA. If you like, it's easy to find the proper wave behavior, but also calculate the proper refraction to the depth of 17-18 rflections in order to get astonishing realism exceeding the 3D max alike. It is not the goal of this class though. The point of the class is to demonstrate how to solve seemingly impossible tasks using Path class.

[Download the source FLA]


I have a little present: Path class in AS1! By the way, when I took off the invisibility of the movies, I found out that it does not look too bad either and also you can move any of the nodes with your mouse.

[Download the source FLA]


If you think "What on earth you might need this ship for?", you are not welcome on this page. This small example opens endless possibilities to a questioning mind and if you did not get it, it will be sort of hard to explain. :)

Anyway, I might try to give you a few thoughts to think about:

  • it is possible to "draw" the speed change over a period of time and read the speed data using Path. I mean that from the point of view of variability of objects' speed diagrams of most programming enviroments, they are just not good enough;
  • it is possible to draw a path and move an object along not strictly following it but change it, bringing into the code factors derived from users's action;
  • it could be used in banners which have lots of Motion Tween to reduce their size;
  • make something up yourself.


After this fantastic, unbelieveable tutorial you haven't bought my Path class?
Well, let it be. No need to buy it. That's a freebie, and you can get it here:

Name: Ivan Dembicki, aka Iv
Location: Moscow, Russia
Age: 36
Flash experience: From 2000
Job: Working for the greatest russian web design company (
| Homepage | News | Games | Articles | Multiplayer Central | Reviews | Spotlight | Forums | Info | Links | Contact us | Advertise | Credits |

| | | |

gotoAndPlay() v 3.0.0 -- (c)2003-2008 gotoAndPlay() Team -- P.IVA 03121770048