FORUMS: list search recent posts

CTI moving in time weirdly

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sebastian Moreno
CTI moving in time weirdly
on Oct 24, 2017 at 11:42:12 am
Last Edited By Sebastian Moreno on Oct 24, 2017 at 11:44:36 am

Hi all
I am doing a quick script to move the current time indicator to a new time given by a edittext field.
so far works to go backwards but behaves differently when I try to go forward in time:


btn01.onClick = function () {

var textInput = Input.text;
var active = app.project.activeItem;

active.time -= textInput; //works fine


}

btn02.onClick = function () {

var textInput = Input.text;
var active = app.project.activeItem;


active.time += textInput;

// works in a digit + digit way
// so if I entered 1 and the current time is 1 it would be: 1+1=11

}

any ideas how this can be solved?

Thanks in advance


Return to posts index

Walter Soyka
Re: CTI moving in time weirdly
on Oct 24, 2017 at 1:34:30 pm

activeTime is being recast as a string because textInput is a string. Therefore, the number 1 is being recast as a string '1' and then concatenated with another string '1', yielding '11'. You want to make sure that your textInput is understood explicitly as a number.

Try:

activeTime += parseFloat(textInput);

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]