# Points in FlashMx

**URL:** <https://forum.kirupa.com/t/points-in-flashmx/222347>\
**Category:** flash\
**Created:** [April 12, 2007, 4:55pm UTC](https://forum.kirupa.com/t/points-in-flashmx/222347 "2007-04-12T16:55:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robtyketto](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@robtyketto](https://forum.kirupa.com/u/robtyketto)\
**Post date:** [April 12, 2007, 4:55pm UTC](https://forum.kirupa.com/t/points-in-flashmx/222347/1 "2007-04-12T16:55:32Z")

</div>

Hi,

This post is a kind of side post to another I have regarding collision detection.  
Helpful advice was to look at using points for collision detection.

However is Flash MX compatiable with points, if so what am I doing wrong in the code below?

I cannot import the class (see below)  
Or declare the variable as a Point (also see below)

```auto
 
//import flash.geom.Point;
 // Calculates the middle point of CPU man sprite as it moves across the screen 
 var cpuPoint:Point = new Point(_root.cpu._x + (_root.cpu._width / 2), _root.cpu._y + (_root.cpu. _height / 2));
 
 trace (cpuPoint);

```

Initially I used hitTest on a ball and spite collision detection but due to the shapes and registration points I had issues.

It would detect a collision and move the ball symbol away by reverting a variable used to store direction and speed and multiplying it by \*-1 to revert direction.

```auto
this.yspeed = this.yspeed*-1;

```

i.e. yspeed = 3 (3 pixels per frame moving up screen) post calculation yspeed = -3  
yspeed = -3 (3 pixels per frame moving down screen) post calculation yspeed = 3

However this would not clear the boundarys of the symbol and simply revert the ball symbol into forever ending loop going back n forth by 3 pixels.

I tried adding do…until loop to increase y co-ordinate until boundary cleared but ending up looping and using too much memory.

Is there a easy method to help with this collision detection.  
Previous post (hope its ok to link to previous post):-

> **[Pong Game - HitTest/getBounds advice & guidance needed](https://www.kirupa.com/forum/showthread.php?t=255508)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

Thanks  
Rob
