Page 1 of 1

Problem with expression controls

Posted: January 4th, 2008, 6:02 am
by Oyvind
Hi!

I'm having a problem using a Slider control. What I'm trying to to is to have a textlayer read portions of another textlayer. Here's my expression on the textlayer:

Code: Select all

i=effect("Slider Control")("Slider");
source=thisComp.layer("Textsource").text.sourceText.substring(0,i);

Let's say I set my slider control to a value of 10, nothing happens... But if I alter the expression to look like this

Code: Select all

i=10;
source=thisComp.layer("Tekstkilde").text.sourceText.substring(0,i);
it works...

What am I missing?

Cheers!

Øyvind Veberg

Posted: January 4th, 2008, 6:32 am
by Paul Tuersley
Not sure why you need to add it....but this works:

Code: Select all

i=effect("Slider Control")("Slider").value; 

Posted: January 4th, 2008, 6:35 am
by Oyvind
Thanks! You just saved my day ! :D

Re: Problem with expression controls

Posted: January 7th, 2008, 11:50 pm
by Mylenium
Oyvind wrote: What am I missing?
The return value from the slider is not rounded automatically which renders your substring defunct. As Paul already pointed out, you need to declare it explicitly as a math value to make JavaScript's automatism's kick in. Expression controls as such are just dumb elements that return a value without declaring what type this value actually is or which class it fits in. In general this is good, but sometimes it works against you. ;-)

Mylenium