polygonal shape collision detection

Hi All,

I got a road movie clip,
and there are many movie clips  (abstackles on the road)

there ara different shapes movieclips on the background, (trees, stones etc ... these are stable)  (1.layer)
I added 2.layer, and put the small rectangular movie clip (piece) in order to check the collision

I got this code to check the collision,

and as the pieces movieclips increses it runs slowly

      for (piece in _root.road) {
            if (car.hitTest(_root.road[piece])) {
                  speed = 0;
                  car_hit = true;

Is there easier way?
Can we check the collisions polygonal shapes?

LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh ChopraCommented:
You can calculate the hitTest at pixel level in Flash 8, using BitmapData.hitTest

here is a sample with source FIle

I feel this is what you want...

: - Aneesh

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nurbekAuthor Commented:
thanks for giving the link,

It works, but it also slows down, uses more memory,

I solved it using my code, I splitted the movieclip into small parts, as the car moves it gets the name of the movieclips(road) that the car over on it ,

and loop inside only that movie, (before I was looping through all movieclips)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.