TypeError: Error: #1010: A term is undefined.. [AS3]

Hello,

So, with a recent switch to AS3, learning a bit better about events and other stuff, I decided to port my A* Pathfinder from AS2 to AS3, and at the end of things I get the following error during runtime: “TypeError: Error #1010: A term is undefined and has no properties”, I’ve been looking through the class a couple of times, and I’m probably blind, so I’m asking for your help :slight_smile: Improvement suggestions are welcome aswell :beer2:
[AS]
package {
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.geom.Point;

public class Pathfinder extends EventDispatcher {
	private const _dirs:Array	= [
				   					{x:0, y:-1},{x:1, y:-1},{x:1, y:0},{x:1, y:1},
				   					{x:0, y:1},{x:-1, y:1},{x:-1, y:0},{x:-1, y:-1}
				   				];
		
	private var cost_diag:int	= 14;
	private var cost_orth:int	= 10;
	
	private var grid:Array			= [];
	private var openList:Array		= [];
	private var closedList:Array	= [];
	private var finalPath:Array		= [];
	
	private var start:pathBlock;
	private var goal:pathBlock;
	
	public var available:Boolean	= true;
		
	public function Pathfinder():void {};
	
	public function findPath(g:Array, s:Point, goal:Point):void {
		this.start = new pathBlock(s.x, s.y);
		this.goal = new pathBlock(goal.x, goal.y);
		for(var i:uint = 0;i<g.length;i++){
			grid* = [];
			for(var j:uint = 0;j<g*.length;j++){
				grid*[j] = new pathBlock(j, i, 0, 0, null, g*[j].w);
			}
		}
		openList.push(this.start);
		addEventListener("nextPath", eventHandler);
		checkAdjacentBlocks(openList_next());
	}
	
	public function getPath():Array {
		return finalPath;
	}
	
	private function eventHandler(evt:Event):void {
		if(evt.type == "nextPath"){
			var block:pathBlock = openList_next();
			if(block != goal){
				checkAdjacentBlocks(block);
			} else {
				optimizePath();
			}
		}
	}
	
	private function optimizePath():void {
		var c:pathBlock = goal;
		while(c != start){
			finalPath.push(new Point(c.x, c.y));
			c = grid[c.y][c.x].p;
		}
		dispatchEvent(new Event("pathCompleted"));
	}
	
	private function checkAdjacentBlocks(block:pathBlock):void {
		for(var i:uint = 0;i<_dirs.length;i++){
			var x:uint = block.x + _dirs*.x;
			var y:uint = block.y + _dirs*.y;
			var g:uint = (_dirs*.x == 0 || _dirs*.y == 0)? block.g + cost_orth : block.g + cost_diag;
			if(grid[y][x] != undefined){
				if(grid[y][x].w){
					if(closedList_exists(grid[y][x])){
						if(!openList_updateCondition(grid[y][x])){
							grid[y][x].update(x, y, g, manhatCost(grid[y][x], goal), block);
							openList.push(grid[y][x]);
						}
					}
				}
			}
		}
		openToClosed(block);
		dispatchEvent(new Event("nextPath"));
	}
	
	private function openToClosed(block:pathBlock):void {
		for(var i:uint = 0;i<openList.length;i++){
			if(openList* == block){
				if(i > 0){
					var tmp:pathBlock = openList*;
					openList* = openList[0];
					openList[0] = tmp;
				}
				closedList.push(openList.shift());
				break;
			}
		}
	}
	
	private function closedList_exists(block:pathBlock):Boolean {
		for(var i:uint = 0;i<closedList.length;i++){
			if(closedList* == block){
				return true;
				break;
			}
		}
		return false;
	}
	
	private function openList_next():pathBlock {
		var n:pathBlock = openList[0];
		for(var i:uint = 1;i<openList.length;i++){
			n = (n.f < openList*.f)? n : openList*;
		}
		return n;
	}
	
	private function openList_updateCondition(block:pathBlock):Boolean {
		for(var i:uint = 0;i<openList.length;i++){
			if(openList* == block){
				if(openList*.g < block.g){
					openList*.p = block.p;
				}
				return true;
				break;
			}
		}
		return false;
	}
	
	private function manhatCost(start:pathBlock, goal:pathBlock):int {
		return cost_orth * ( Math.abs(start.x - goal.x) + Math.abs(start.y - goal.y) );
	};
};

};

class pathBlock {
public var x:uint;
public var y:uint;
public var g:int;
public var h:int;
public var f:int;
public var p:pathBlock;
public var w:Boolean;
public var v:uint;

public function pathBlock(x:uint, y:uint, g:int = 0, h:int = 0, p:pathBlock = null, w:Boolean = true, v:uint = 0):void {
	update(x, y, g, h, p);
	this.w = w;
	this.v = v;
};
public function update(x:uint, y:uint, g:int, h:int, p:pathBlock):void {
	this.x = x;
	this.y = y;
	this.g = g;
	this.h = h;
	this.f = g + h;
	this.p = p;
};

};
[/AS]

P.S: I don’t know if this would actually be anything close to real A either, this is my interpretation of it :)*