Note that there are some explanatory texts on larger screens.

plurals
  1. POPolygon draw in ActionScript 3.0 - Vector.<Number> Vector.<int> drawPath() Flash Player 10 vs 9 error
    text
    copied!<p>I am working on a Flash application that draws polygons vertex by vertex line by line from a few tutorials.</p> <p>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:</p> <ul> <li>AS_Classes\Polygon.as, Line 8 1046: Type was not found or was not a compile-time constant: Number.</li> <li>AS_Classes\Polygon.as, Line 9 1046: Type was not found or was not a compile-time constant: int.</li> <li>AS_Classes\Polygon.as, Line 18 1120: Access of undefined property Number.</li> <li><p>AS_Classes\Polygon.as, Line 19 1120: Access of undefined property int.</p> <ul> <li>How do I convert this to Flash Player 9?</li> <li>Is there simple replacements for these? I think it is "drawPath()" that is Flash 10.</li> </ul></li> </ul> <p>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.</p> <p>Part of the code throwing the first errors:</p> <pre><code>package com.AS_Classes { import flash.display.Sprite; public class Polygon extends Sprite{ (Line 8) public var pathCoords:Vector.&lt;Number&gt;; (Line 9) public var pathCommands:Vector.&lt;int&gt;; public var fillColor:uint; public function Polygon(_vertexList,_fillColor=0x000000) { fillColor = _fillColor; (Line 18) pathCoords = new Vector.&lt;Number&gt;(); (Line 19) pathCommands = new Vector.&lt;int&gt;(); //first moveTo pathCommands[0]=1; pathCoords.push(_vertexList[0].x); pathCoords.push(_vertexList[0].y); //next LineTos for (var i:int = 1; i&lt;= _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(); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload