I am working on a Flash application that draws polygons vertex by vertex line by line from a few tutorials.
The problem - I have it all working in Flash Player 10, but need it in Flash Player 9. When I convert it to Flash Player 9, I get these errors:
- AS_Classes\Polygon.as, Line 8 1046: Type was not found or was not a compile-time constant: Number.
- AS_Classes\Polygon.as, Line 9 1046: Type was not found or was not a compile-time constant: int.
- AS_Classes\Polygon.as, Line 18 1120: Access of undefined property Number.
AS_Classes\Polygon.as, Line 19 1120: Access of undefined property int.
- How do I convert this to Flash Player 9?
- Is there simple replacements for these? I think it is "drawPath()" that is Flash 10.
This, "var vertexList:Vector.; vertexList = new Vector.(); " ... is also used throughout the code for "graphics.moveTo(vertexList[vertexList.length-1].x", although I think that "moveTo()" is compatible for Flash 9.
Part of the code throwing the first errors:
package com.AS_Classes {
import flash.display.Sprite;
public class Polygon extends Sprite{
(Line 8) public var pathCoords:Vector.<Number>;
(Line 9) public var pathCommands:Vector.<int>;
public var fillColor:uint;
public function Polygon(_vertexList,_fillColor=0x000000) {
fillColor = _fillColor;
(Line 18) pathCoords = new Vector.<Number>();
(Line 19) pathCommands = new Vector.<int>();
//first moveTo
pathCommands[0]=1;
pathCoords.push(_vertexList[0].x);
pathCoords.push(_vertexList[0].y);
//next LineTos
for (var i:int = 1; i<= _vertexList.length-1; i++) {
pathCoords.push(_vertexList[i].x);
pathCoords.push(_vertexList[i].y);
pathCommands.push(2);
}
//final LineTo
pathCommands.push(2);
pathCoords.push(_vertexList[0].x);
pathCoords.push(_vertexList[0].y);
}
public function Re_Draw():void{
this.graphics.clear();
this.graphics.beginFill(fillColor);
this.graphics.drawPath(pathCommands,pathCoords);
this.graphics.endFill();
}
}
}