Not sure how to properly title this so I went with something that I thought was better than the normal “what’s wrong with this?” title…anyways…on to the issue at hand.
basically i have a prototype that creates polygons based on an array. works well.
i then have another prototype that’s supposed to create polygons using said polygon prototype.
So the below is:
1 - the polyMaker prototype
2 - an array of arrays ($arrowListB). basically each array item should be a new polygon.
3 - the problematic genArrows prototype.
what it should do is loop through the $arrowListB array and create a container clip ($cont). Within each container clip it should make a $arrowClip to be used in making the polygon (an arrow actually).
it works until i get to the line after creating the movieclips:
$arrowClip.polyMaker(..arguments..)
once i put that line in, it only makes one polygon and doesn’t create the other (7 in this case) movie clips. I’m not sure if I’m just not referencing correctly or what. Any help would be appreciated.
MovieClip.prototype.polyMaker = function($args:Array):Void {
this.moveTo(arguments[0][0], arguments[0][1]);
for (i=1; i<arguments.length-1; i++) {
this.lineTo(arguments*[0], arguments*[1]);
}
this.lineTo(arguments[arguments.length-1][0], arguments[arguments.length-1][1]);
};
var $arrowListB:Array = [['ABC', 2], ['DEF', 127], ['GHI', 342], ['JK', 387], ['LMN', 529], ['OP', 585], ['QRST', 641], ['UVWX', 692]];
MovieClip.prototype.genArrows = function($array:Array) {
trace($array.length);
for (i=0; i<$array.length; i++) {
var $txt:String = $array*[0];
var $x:Number = $array*[1];
var $cont:MovieClip = this.createEmptyMovieClip($txt.toLowerCase()+'_mc', i);
var $arrowClip:MovieClip = $cont.createEmptyMovieClip('arrow_mc', 1);
//if the following line is commented, all clips are made.
$arrowClip.polyMaker([5, 0], [41, 0], [41, 19], [46, 19], [23, 35], [0, 19], [5, 19], [5, 0]);
}
};
_root.genArrows($arrowListB);