Movement trough waypoints

Hey,

I’m trying to make this little game, where tanks fight with each other.
Now, we need an object that will move along the edges of the field, from corner to
corner.

I’ve tried making waypoints. Gave them numbers and the positions they are located at.
The object does go to the first waypoint, but stops there and doesn’t move to 2,3,4 etc.
This is however asked inside the script, so I don’t know why it stops at waypoint 1.
I’ve tried that, but it doesn’t work.

So now I have put these waypoints inside an array. Problem is: how do I make this array detect at which waypoint the object is located, and add another number in the pointholder (in other words: if object is at waypoint[1], add 1 so the next waypoint it has to go to will be waypoint[2] etc etc etc)
I’ll post a piece of the script here:


var nextPoint = 0; //next point
var pointHolder:Array = new Array; //pointholder

public function generateWayPoint()
{
// Get arena size
var arenaInfo : ArenaInfo = this.getArenaInfo();

// Generate waypoint a little off the edges
this.m_waypoint = pointHolder[nextPoint][0]; //+ Math.random() * (arenaInfo.getWidth() - 40);

if(this.x,y == pointHolder[nextPoint][0])
{
nextPoint++;
}
}

This is the error I get when using this script:

ReferenceError: Error #1069: Property 0 not found on flash.geom.Point and there is no default value.

Can somebody tell me what I’m doing wrong?