• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expression - Comp Name turns check box on or off

Community Beginner ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

Hey I'm trying to use a comp name to determine the opacity of a certain layer using expressions and I can't get it to work! I'm still very new to expressions and javascript, I was wondering if someone here might know the answer...

My code:

Under Checkbox:

on = effect("Checkbox Control")("Checkbox");

compName = comp("nbc. new year's eve").name;

compStation = compName.substring(0, ".");

n = "nbc"

if (compStation == n) {

on == 1;

} else {

on == 0;

}

Under Opacity:

visibility = effect("Checkbox Control")("Checkbox");

if (visibility == 0) { opacity = 100; } else {opacity = 0;}

Views

352

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
People's Champ ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

111792  wrote

on == 1;

} else {

on == 0;

}

I don't know much about coding but I can tell you that your "==" operators in these two lines is wrong.

They should be single "=".

Double equals compares or querys values.

Single equals set value.

~Gutterfish

Votes

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
LEGEND ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

LATEST

As Gutter-Fish said, you are using the logic operator ==, not the assignment operator = .

Mylenium

Votes

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