Activity › Forums › Adobe After Effects › integers and strings…
-
integers and strings…
Posted by Danny Princz on October 4, 2006 at 7:21 pmi am trying to write a script that takes a layeys sourcetext, does some math then replaces the text.
i can get the parseInt to work, but how do i get the result back to a string?
i found parseString on google but AE doesnt seem to support it?
thanks
Danny Princz replied 19 years, 7 months ago 2 Members · 6 Replies -
6 Replies
-
Dan Ebberts
October 4, 2006 at 8:20 pmTwo ways:
myString = “” + myVariable;
or,
myString = myVariable.toString();
Dan
-
Danny Princz
October 4, 2006 at 8:42 pmthanks dan as always.
i tried both ways but im still getting NAN showing up
any idea what im doign wrong?
var myComp = app.project.activeItem; // active Comp
var redTeamScore = myComp.layer(“red score”);
var redScore = redTeamScore.text.sourceText;
var currTime = redTeamScore.time;
var redScoreInt = parseInt(redScore);
var newRedScoreInt = (redScoreInt+1)
var newRedScore = “” + newRedScoreInt();redTeamScore.text.sourceText.setValueAtTime(currTime,newRedScore);
-
Dan Ebberts
October 4, 2006 at 10:01 pmI can see a few errors. Try this:
var myComp = app.project.activeItem; // active Comp
var redTeamScore = myComp.layer(“red score”);
var redScore = redTeamScore.sourceText.value.text;
var currTime = redTeamScore.time;
var redScoreInt = parseInt(redScore);
var newRedScoreInt = (redScoreInt+1)
var newRedScore = “” + newRedScoreInt;redTeamScore.sourceText.setValueAtTime(currTime,newRedScore);
Dan
-
Danny Princz
October 4, 2006 at 10:43 pmthanks again
so why do i need to add the .value where in an expression i can reference the value w/o it?
thanks
-
Dan Ebberts
October 5, 2006 at 3:52 amHard to say. I’m sure the Adobe engineers did their best to make the syntax consistent, but there are some differences.
Dan
-
Danny Princz
October 5, 2006 at 4:08 pmaha
and i thought there was some good reason behind it :-/
thanks again for all your help
you’ve helped me make this project a whole lot more pleasant!
Reply to this Discussion! Login or Sign Up