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

fix a scrollbar

$
0
0

Hi guys,

 

I  created a scrollbar and activate  him in my script,

but wen i use scrollbar my buttons that down are cat...  

 

what can I do to fix this?

 

 

לכידה.PNG

 

{

var numItemsB=200;

var TheButtons=[];

 

 

 

 

for  (var i=0;i<numItemsB;i++){

    TheButtons.push(i);

    };

 

 

 

 

var scriptName = "test";

  var btnSize =40;

  var scrollbar;

  var btnGroup;

  var AIBtns;

   

   

test1(this);

function test1(thisObj){

  var myWin = ctrlMaker_buildUI(thisObj);

  if (myWin instanceof Window){

  // Center the palette

  myWin.center();

  // Show the UI

  myWin.show();

  }

  else{

  myWin.layout.resize();

  };

//======================================================================================== ==================================

  function ctrlMaker_buildUI(thisObj){

  var myWin = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, [200, 200, 500, 400], {resizeable: true});

 

  scrollbar = myWin.add("scrollbar");//<<<<<<<<<<<<<<<<<<<<  

         btnGroup = myWin.add("group", undefined);

//---------------------------------------------------------------------------------------- ---

  AIBtns = [];

  for (var i=0; i<TheButtons.length; i++){

  AIBtns[i] = btnGroup.add("button", undefined, i);

  AIBtns[i].size = [btnSize, btnSize];

  };

  myWin.onResize =myWin.onResizing = ctrlMaker_doResizePanel;

  myWin.onShow = ctrlMaker_doResizePanel;

  return myWin;

  }

//======================================================================================== ==================================

 

 

  function ctrlMaker_doResizePanel(){

 

 

  var btnOffset = btnSize + 2;

         var maxRightEdge = myWin.size.width - btnOffset;

    var maxBattomEdge = myWin.size.height - btnOffset;

  var leftEdge = 2;

  var topEdge = 2;

       

        // Reset the background group container's bounds

        scrollbar.bounds = [ myWin.size.width-22,0,  myWin.size.width, myWin.size.height];

        btnGroup.bounds = [0, 42, myWin.size.width, myWin.size.height];

       

       

        // Reset each button's layer bounds

        for (var i=0; i<TheButtons.length; i++){

  AIBtns[i].bounds = [leftEdge, topEdge, leftEdge+btnSize, topEdge+btnSize];

  AIBtns[i].size=[btnSize,btnSize];

  leftEdge += btnOffset;

  // Create a new row if no more columns available in the current row of buttons

  if (leftEdge > maxRightEdge){

  leftEdge = 2;

  topEdge += btnOffset;

  };

  };

       

                            var rpws=Math.ceil(((topEdge+btnSize)-maxBattomEdge)/60);

                    var SBChingValue=(rpws*(60/rpws));

                    var AddBtnGroupheight=(topEdge+btnSize);

                    var SBvlu;

                   

                    scrollbar.maxvalue=rpws;

 

 

                        scrollbar.onChanging = function () {

                var children = btnGroup.children; 

                for (var n=0; n<children.length; n++){ 

                   

                        btnGroup.location.y = (-SBChingValue*this.value);

                                                    }; 

                                            };

                       btnGroup.bounds = [0, 0, myWin.size.width, myWin.size.height+AddBtnGroupheight];

       

       };

    };

}


Viewing all articles
Browse latest Browse all 2143

Trending Articles