Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
Oyvind
Topic Author
Posts: 2
Joined: Fri Jun 18, 2004 2:07 am

Problem with expression controls

Fri Jan 04, 2008 6:02 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:

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

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: Sat Jun 05, 2004 7:59 am
Location: London, UK

Fri Jan 04, 2008 6:32 am

Not sure why you need to add it....but this works:
i=effect("Slider Control")("Slider").value; 
 
Oyvind
Topic Author
Posts: 2
Joined: Fri Jun 18, 2004 2:07 am

Fri Jan 04, 2008 6:35 am

Thanks! You just saved my day ! :D
Øyvind Veberg

Motion Graphics Designer
 
Mylenium
Posts: 139
Joined: Wed Jul 20, 2005 12:07 am

Re: Problem with expression controls

Mon Jan 07, 2008 11:50 pm

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]

Who is online

Users browsing this forum: No registered users and 3 guests