Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
LettuceAndTomatoePLZ
Topic Author
Posts: 2
Joined: Thu Jan 29, 2015 6:23 pm

Translate source text into a number?

Thu Jan 29, 2015 7:18 pm

Hello,

I'm trying to control the value of a slider with a TextProperty number (the Source Text property in a text layer). Is this possible in AE CC 2014?
I can't directly pickwhip from my slider stopwatch to my source text stopwatch, the error I'm presented with is:

"Error at line 0 in property 'Slider' of layer 3 ('expression') in comp '4-Build'. Object of type TextProperty found where a Number, Array, or Property is needed."

How do I translate my TextProperty into a number?

Thanks for your time.
~ L&TPLZ
 
Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Translate source text into a number?

Mon Feb 02, 2015 4:31 pm

Something like this should work:

txt = thisComp.layer("Text Layer").text.sourceText.value;
n = parseFloat(txt);
if (isNaN(n)) value else n;


Dan
 
LettuceAndTomatoePLZ
Topic Author
Posts: 2
Joined: Thu Jan 29, 2015 6:23 pm

Re: Translate source text into a number?

Wed Feb 04, 2015 4:30 pm

Dan Ebberts wrote:
Something like this should work:

txt = thisComp.layer("Text Layer").text.sourceText.value;
n = parseFloat(txt);
if (isNaN(n)) value else n;


Dan

Thank you so much, Dan!

PS. I'm not sure if you'll see this response, but you have figuratively saved my butt so many times with your immense knowledge and generous contributions to the AE community over the years.

So what I really mean to say is, MEGA THANK YOU Dan!

Who is online

Users browsing this forum: No registered users and 1 guest