Return-Path: Received: from mail-la0-f45.google.com ([209.85.215.45] verified) by media-motion.tv (CommuniGate Pro SMTP 4.2.10) with ESMTP-TLS id 5451308 for AE-List@media-motion.tv; Wed, 23 Apr 2014 18:29:40 +0200 Received: by mail-la0-f45.google.com with SMTP id hr17so982905lab.4 for ; Wed, 23 Apr 2014 09:29:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=xNKlr1ZZY4pJY+ZSQnrsDdc8m6pjQSUgh7kGEXpk5Nw=; b=bDOWFrEZetwmQLJl+5t2JBP7wrW/8B4GohzOwb6Gy2Nn1zMReYp+SpV4WtxO5rQNfG YpHOSqw10Lb+t5kYBKyquhgl18c6F0B7vQv8xsmOmqdWE4/b4m9d8QObSUYt9V8lyNPP bP9sqjeyyViIP6kiDoY7oUFJe8U2G8ZEFp80bKtDqy0s49QTr5NCg8nURdvCqANc8hyD fCm256C14S8OqU6xpu0IjYbJ1YuxD6w7oSIvzmNwtDpy3/vkX1bhszE8/MNwBSapyj53 lP6+UsIiqCBeGrk2ByX6NwJCNkAGQIJYGkopLR7Y4gRYK7Zu8qZiIPyaCOCeY4Y3PvFS 47FA== X-Gm-Message-State: ALoCoQm0FcpEu/IUtsumbT1TC3VGh90A+fyHsQXHxtjxUedxwJB4fbFPWBoaFQu3/z/PyhIehwkg MIME-Version: 1.0 X-Received: by 10.152.22.166 with SMTP id e6mr81922laf.71.1398270580060; Wed, 23 Apr 2014 09:29:40 -0700 (PDT) Received: by 10.114.5.194 with HTTP; Wed, 23 Apr 2014 09:29:40 -0700 (PDT) Date: Wed, 23 Apr 2014 17:29:40 +0100 Message-ID: Subject: Extendscript Question - Array length problem From: Phil Bearman To: After Effects Mail List Content-Type: multipart/alternative; boundary=089e0160c16439899c04f7b83dd1 --089e0160c16439899c04f7b83dd1 Content-Type: text/plain; charset=ISO-8859-1 Hi all, I'm doing some scripting in AE, and need to iterate through an Array of Objects, so need to find out the number of items in the array in order to set up the loop. I had expected to be able to get the number of items using myArray.length, but this gives an 'undefined' error in ExtendScript. The array has been populated with a loop in the following manner: for (var i=0; i < myWidthValues.length; i++) { myArray[i].width=myWidthValues[i]; myArray[i].height=myHeightValues[i]; } (this isn't the real code, just a simplified example) And the array is functioning as expected (so for example myArray[2].width gives the result I expect). Is there a reason that an Array of Objects won't return a 'length' value? (I know this question would be better suited to a general javascript forum, but I've trawled internet forums to no avail, and thought I'd ask here first in case it's a quirk specific to ExtendScript). Any help much appreciated! Phil -- *Phil Bearman* *Phil Bearman Creative Media Solutions* Motion Graphics Design www.PhilBearman.co.uk : Nightclub & Bar ~ Production, Corporate & Events ~ DVD Products 0161 236 2581 - 9am-5pm, Monday-Friday --089e0160c16439899c04f7b83dd1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi all,=A0

I'm doing some scripting= in AE, and need to iterate through an Array of Objects, so need to find ou= t the number of items in the array in order to set up the loop.
<= br>
I had expected to be able to get the number of items using myArr= ay.length, but this gives an 'undefined' error in ExtendScript.

The array has been populated with a loop in the follo= wing manner:

for (var i=3D0; i < myWidthValues.length; i++)
=
{
myArray[i].width=3DmyWidthValues[i];
myArray[i].= height=3DmyHeightValues[i];
}

(this isn&= #39;t the real code, just a simplified example)

And the array is functioning as expected (so for exampl= e myArray[2].width gives the result I expect).

Is = there a reason that an Array of Objects won't return a 'length'= value?

(I know this question would be better suited to a gener= al javascript forum, but I've trawled internet forums to no avail, and = thought I'd ask here first in case it's a quirk specific to ExtendS= cript).

Any help much appreciated!

Phi= l

--

Ph= il Bearman

Phi= l Bearman Creative Media Solutions=20
Motion Graphics Design

www.PhilBearman.co.uk : Nightclub=20 & Bar ~ Production, Co= rporate=20 & Events ~ DVD Product= s=A0


0161 236 2581 - 9am-5pm, Monday-Friday


--089e0160c16439899c04f7b83dd1--