Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Error in this scale syntax - after 2021

New Here ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

 

s = [];
ps = parent.transform.scale.value;
for (i = 0; i < ps.length; i++){
s[i] = value[i]*100/ps[i];
}
s

TOPICS
Expressions

Views

57

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

Properties have a default value. Defining s=[] is therefore utterly nonsensical. Likewise, s[i] does not make any sense within your loop. and finally, of course scale is a 2D prooperty, so yopur final line would have to be [s,s] or something like that. Start by actually reading up on how expressions work instead of just reusing someone else's code that you don't understand.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

LATEST

It seems you would like to build an array. In JavaScript you do such a thing with push():

 

arr = ["Foo", "Bar"]

arr.push("Hello World")

>> arr

>> ["Foo", "Bar", "Hello World"]

 

Try:

    val = value[i]*100 / ps[i];

    s.push(val);

 

*Martin

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines