# Prototypes in AS 3.0

**URL:** <https://forum.kirupa.com/t/prototypes-in-as-3-0/231921>\
**Category:** flash\
**Created:** [July 9, 2007, 4:42pm UTC](https://forum.kirupa.com/t/prototypes-in-as-3-0/231921 "2007-07-09T16:42:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neweller](https://avatars.discourse-cdn.com/v4/letter/n/b19c9b/32.png) [@neweller](https://forum.kirupa.com/u/neweller)\
**Post date:** [July 9, 2007, 4:42pm UTC](https://forum.kirupa.com/t/prototypes-in-as-3-0/231921/1 "2007-07-09T16:42:35Z")

</div>

Hello,

I am currently trying to rewrite the tile game code of [http://www.tonypa.pri.ee/](http://www.tonypa.pri.ee/) in AS 3.0 and I am running into some issues. The first thing that gets me is the use of prototypes.Ⓜ

Also I change the code base to use the Sprite class :book:

game.Tile0.prototype.walkable = true;  
game.Tile0.prototype.frame = 1;

How does a prototype play into the roll of a package in AS 3? Does it exist? I think I understand the ideal of a prototype (a single property of a var that differs from any other property).

package {  
import flash.display.Sprite;  
public class MyGame extends Sprite {  
private var myMap:Array = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];  
private var speed:Number = 0;  
private var damage:Number = 0;  
private var fuel:Number = 1000;  
public var game:Array = {tileW:30, tileH:30, currentMap:1, visx:7, visy:5};  
public function game.Tile0():void { };

```
	game.Tile0.prototype.walkable = true;
	game.Tile0.prototype.frame = 1;

	public function takeOff():void {
		// . . .
	}
	public function crash():void {
		// . . .
	}
	public function shoot():void {
		// . . .
	}
	public function selfDestruct():void {
		// . . .
	}
}

```

}
