Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
lowtech19
Topic Author
Posts: 3
Joined: Thu Jan 28, 2010 9:34 am

cash multipler

Wed Mar 09, 2011 2:09 pm

i need to create an expression that will take a cash value of (y) Y= $1.28 and have it multiplied by (x). X needs to be connected to a slider or something i can key... this way i can key a single slider to just multiple the value of (y) * (x).
 
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: Thu Jun 17, 2004 9:27 am
Location: New York City, NY
Contact:

Re: cash multipler

Mon Mar 21, 2011 12:16 pm

So why don't you just do exactly that? y * x
 
RexanaCCf
Posts: 3
Joined: Sat Oct 04, 2014 7:36 pm

Re: cash multipler

Thu Oct 09, 2014 4:13 am

I have same problem with you lowtech19. Have you figure it out?
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: cash multipler

Fri Oct 10, 2014 12:32 am

Avoid multiplying a number with a string.
If you have the possibility, put x and y on separate sliders, and in your text put an expression that formats x*y into what you want, for instance

x=thisLayer.effect("x").slider;
y=thisLayer.effect("y").slider;
"$" + (x*y).toFixed(2);

If you can't (ie the textLayer already has a text of the form $1.28), then
// y is the numeric value carried by the text
x=thisLayer.effect("x").slider;
y = parseFloat(thisLayer.text.value.slice(1));
"$" + (x*y).toFixed(2);

Xavier.

Who is online

Users browsing this forum: No registered users and 3 guests