Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

activeItem doesn't work outside onClick function

$
0
0

Hi,

I need to select timeline so my script can run.

If something else is selected, my script doesn't work.

I've tried to put onChange function with variables into onClick function but it doesn't work.

 

var myWin = new Window("palette","",undefined);

var dropAlign = myWin.add("dropdownlist",undefined, ["Left","Center","Right"]);
dropAlign.selection = 0;

var btn = myWin.add("button",undefined, "OK");

    var curItemHeight = app.project.activeItem.height;    var myHeight = curItemHeight;           dropAlign.onChange = function () {        if (this.selection.index ==0){                myHeight = curItemHeight;            }        if (this.selection.index ==1){                myHeight = curItemHeight/2;            }        if (this.selection.index ==2){                myHeight = curItemHeight/20;            }    }

btn.onClick = function (){
        alert(myHeight);    }

myWin.center();
myWin.show();

 

Thanks


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>