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

Multiple Checkbox Button on/off

$
0
0

Hello everyone,

 

I'm trying to make a button with multiple checkboxes options..

 

Here for exemple with a Fill .

 

Thats works but ,when i switch a checkbox to another one ,i want to turn off the first checkbox value...

 

in this exemple,if i choose the blue one,the others are off,or if a choose the green one the others are off etc......

 

i dont know how to do that ???

 

Any ideas ??

 

Thank you so much if you can help me

 

 

TOM

 

 

here is my code:

 

 

 

function FILL_TOOLS(obj)

 

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

    //================= UI============================

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

  

  {

      

    function addHGroup(conteneur){

  var groupe = conteneur.add("group");

  groupe.alignChildren = ["fill","fill"];

  groupe.orientation = "row";

  groupe.spacing = 1;

  groupe.margins = 0;

  return groupe;

    }

    function addVGroup(conteneur){

        var groupe = conteneur.add("group");

        groupe.alignChildren = ["fill","fill"];

        groupe.orientation = "column";

        groupe.spacing = 1;

        groupe.margins = 0;

        return groupe;

    }

                       

    var fenetre = obj instanceof Panel ? obj : new Window("window","Fill_TOOL",undefined,{resizeable:true});

    fenetre.alignChildren = ["fill", "top"];

    fenetre.spacing  = 1;

    fenetre.margins = 2;

  

    var Group01 = addHGroup(fenetre);

    Group01.alignChildren = ["fill","center"];

    var FILL_Button = Group01.add("button",undefined,"Fill");

  

    var Group01 = addHGroup(fenetre);

    Group01.alignChildren = ["fill","center"];

 

    var Group01 = addHGroup(fenetre);

  

    Group01.alignChildren = ["fill","center"];

    var Button1 = Group01.add("checkbox",undefined,"Pink");

    Button1.size = [50,25];

    Button1.value = true;

  

    Group01.alignChildren = ["fill","center"];

    var Button2 = Group01.add("checkbox",undefined,"Blue");

    Button2.size = [50,25];

 

    Group01.alignChildren = ["fill","center"];

    var Button3 = Group01.add("checkbox",undefined,"Green");

    Button3.size = [50,25];

  

    Group01.alignChildren = ["fill","center"];

    var Button4 = Group01.add("checkbox",undefined,"Purple");

    Button4.size = [50,25];

  

  

//ALL CLICKS____________________________________________________________________

 

FILL_Button.onClick = function ()

 

 

{

    Button1.value == true

    ? MyFunction01 ()

    : Button2.value == true

    ? MyFunction02 ()

    : Button3.value == true

    ? MyFunction03 ()

    : Button4.value == true

    ? MyFunction04 ()

    : SELECT();

}

 

//================= SHOW UI ============

    fenetre.layout.layout(true);

    fenetre.layout.resize();

    fenetre.onResizing = fenetre.onResize = function () {fenetre.layout.resize()};

    if (fenetre != null ) if (fenetre instanceof Window) fenetre.show();

    }

 

FILL_TOOLS(this);

 

 

//FUNCTIONS _________________________________________________________________________________________ _____________________________________

 

 

   function SELECT()

{

alert("select at least a color")

}

 

// _________________________________________________________________________________________ _______________________________________________

    function MyFunction01()

{

 

 

app.beginUndoGroup("AddFill");

 

 

var myFill=app.project.activeItem.selectedLayers[0].property("ADBE Effect Parade").addProperty("ADBE Fill");

myFill.couleur.setValue([232,214,214,255]/255);

 

 

Button1.selection == false

 

 

app.endUndoGroup();

}

 

 

// _________________________________________________________________________________________ _______________________________________________

 

 

function MyFunction02()

{

 

 

app.beginUndoGroup("AddFill");

 

 

var myFill=app.project.activeItem.selectedLayers[0].property("ADBE Effect Parade").addProperty("ADBE Fill");

myFill.couleur.setValue([100,150,200,255]/255);

 

 

Button2.selection == false

 

 

app.endUndoGroup();

}

 

 

// _________________________________________________________________________________________ _______________________________________________

function MyFunction03()

{

 

 

app.beginUndoGroup("AddFill");

 

 

var myFill=app.project.activeItem.selectedLayers[0].property("ADBE Effect Parade").addProperty("ADBE Fill");

myFill.couleur.setValue([10,150,20,255]/255);

 

 

Button3.selection == false

 

 

app.endUndoGroup();

}

 

 

// _________________________________________________________________________________________ _______________________________________________

function MyFunction04()

{

 

 

app.beginUndoGroup("AddFill");

 

 

var myFill=app.project.activeItem.selectedLayers[0].property("ADBE Effect Parade").addProperty("ADBE Fill");

myFill.couleur.setValue([100,10,200,255]/255);

 

 

Button4.selection == false

 

 

app.endUndoGroup();


Viewing all articles
Browse latest Browse all 2143

Trending Articles



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