## cash multipler

Moderators: Disciple, zlovatt

lowtech19
Posts: 3
Joined: January 28th, 2010, 9:34 am
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).
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:
So why don't you just do exactly that? y * x
RexanaCCf
Posts: 3
Joined: October 4th, 2014, 7:36 pm
I have same problem with you lowtech19. Have you figure it out?
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 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.