Highlighted

Don't want continuous values

New Here ,
Sep 29, 2020

Copy link to clipboard

Copied

onChange in a slider runs through too many calculations because it tries to interpolate them continuously which takes up too much processing. Instead, is there a way to make onChange or slider only calculate  integers and not try to calculate everything in between? 

TOPICS
Actions and scripting, How to

Views

46

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Don't want continuous values

New Here ,
Sep 29, 2020

Copy link to clipboard

Copied

onChange in a slider runs through too many calculations because it tries to interpolate them continuously which takes up too much processing. Instead, is there a way to make onChange or slider only calculate  integers and not try to calculate everything in between? 

TOPICS
Actions and scripting, How to

Views

47

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 29, 2020 0
Adobe Community Professional ,
Sep 29, 2020

Copy link to clipboard

Copied

You mentioned onChange, but this will work with both onChange and onChanging. Basically convert the slider value to an integer before it calculates anything.

 

var dlg = new Window('dialog','test')
var sdr = dlg.add('slider',undefined,0,0,100);
var sTxt = dlg.add('statictext',undefined, sdr.value)
sTxt.size = [20,50];
sdr.onChanging = function(){
    sdr.value = Math.round (sdr.value);
    sTxt.text = sdr.value
    }
dlg.show()

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 1