Creating Trail of dots in As3

This is a short tutorial on how to make a Trail in As3 flash (Flash Develop or Adobe Flash). While making MinBa or Minimal basketball, i created a simple trail quickly.  It was pretty simple to do, at least i think it is.

trail_demo

View Demo

(Cute Aeroplane made in Inkscape – Download it Here for Free to use)

Unoptimized Way 😉

Instead of posting the Code, i’ll summarize the steps i did.

1. Create a pool of around 50 dots (sprites with a circle drawn) and made it invisible.

2. Keep track of visible dots by keeping a poolindex and poolcount(for reseting).

3. Show one dot by passing x & y value of the tracked object and made visible that dot at that location.

4. [Optional] kept a timer to put some duration between placing the dots (kept it at a distance).

Code :

So after a while i thought, why i need a pool and stuff like that, when i can just draw a circle again and again onto a bitmapData. That seems pretty neat.

Skip the above steps 1 & 2.

Feel free to add in your comments, doubts etc.

1636 Total Views 2 Views Today

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *