Problem with expression controls

Moderators: Disciple, zlovatt

Post Reply
Oyvind
Posts: 2
Joined: June 18th, 2004, 2:07 am

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
Øyvind Veberg
Motion Graphics Designer
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Not sure why you need to add it....but this works:

Code: Select all

i=effect("Slider Control")("Slider").value; 
Oyvind
Posts: 2
Joined: June 18th, 2004, 2:07 am

Thanks! You just saved my day ! :D
Øyvind Veberg
Motion Graphics Designer
Mylenium
Posts: 139
Joined: July 20th, 2005, 12:07 am

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
[Pour Mylène, ange sur terre]
Post Reply