I've an array with some properties. When I try to find an object's index I'm getting error TypeError: Error #1009. I'm using Flash CS6.
Here's my array:
Below code is giving me error #1009 while I want it to return a1:Code:var squareArr:Object = { a1: { piece: wr1_txt, pieceLoc: { x: "-3", y: "347" } }, b1: { piece: wn1_txt, pieceLoc: { x: "47", y: "347" } }, ...
I tried:Code:trace (squareArr.indexOf(wr1_txt));
but it says not foundCode:var s:String; var found:Boolean=false; for (s in squareArr) { if (squareArr[s].piece == wr1_txt) { // YAY found it found=true; break; } } if (found) trace(s); else trace("Not found!");


Reply With Quote
