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

Expressions: Trace / Alert Reporting ?

Contributor ,
Dec 16, 2022 Dec 16, 2022

Copy link to clipboard

Copied

Hi everybody,

 

In the Flash/Actionscript days, we'd run a trace() to get a test or variable response. In HTML5 or anything DOM-based we'd place an alert() to get a basic response for routines. 

 

What is used in AFX expressions to make sure a value or variable is being defined or seen by the processor? I tried the term Alert() to try and get a value to echo but it gave me a syntax error. 

 

You guys (and gals) have been great, thanks!

TOPICS
Expressions , How to

Views

86

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
Community Expert ,
Dec 16, 2022 Dec 16, 2022

Copy link to clipboard

Copied

Ah yes. Debugging complex expressions can require some resourcefulness. Say you have an expression like this, and it isn't generating an error, but it isn't giving the result you expect:

a = 1;
b = 2;
c = a + b;
d = 4;
c + d;

You suspect that variable c might be the culprit, so you append a throw() to your expression, like this:

a = 1;
b = 2;
c = a + b;
d = 4;
c + d;
throw("c = " + c)

Now you'll get an error message and at the bottom of it will be: c = 3

Another thing you can do is to apply your expression (possibly with some modifications required) to the Source Text property of a text layer and comment out certain lines so that the expression just gets to a particular variable you're interested in and the result will be displayed in the text layer. 

Or sometimes you can just append a variable name to the end of an expression that isn't working, but isn't generating an error message just to check the value of a particular variable (remember that the last value calculated in an expression is the one that gets reported as the result). 

There are a lot of little tricks like that you'll learn along the way...

 

 

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 17, 2022 Dec 17, 2022

Copy link to clipboard

Copied

LATEST

Comment out the parts that work to debug the ones that don't, apply expressions to text layers or inert expression controls just to plot the output values without making e.g. an effect crash.

 

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