Weird behavior when adding multiple sliders
Posted: September 20th, 2009, 7:07 pm
Hi gang,
i'm facing a really weird behavior, and I was wondering what i've been doing wrong.
I'm creating a new adjustement layer, and I want to add 3 slider controls on it and customize them.
This is the code I wrote:
This code rejects me, and the debugger pops up saying that the line SliderOne.property("ADBE Slider Control-0001").setValue(20); is an undefined object.
But if I write the code this way, it works:
But the problem is, if I wanna use my variables later on the code, it will fail, saying that they are an undefined object.
For exemple, try adding after the second code this line and the execution will fail:
In fact, if i comment the SliderTwo & SliderThree declaration everything works fine, as if I was not allowed to add more than 1 slider control to a layer with this way.
Any hints ?
i'm facing a really weird behavior, and I was wondering what i've been doing wrong.
I'm creating a new adjustement layer, and I want to add 3 slider controls on it and customize them.
This is the code I wrote:
Code: Select all
var Controler = myObj.ActiveLayers.addSolid([1,1,1], "Controler", myObj.ActiveComp.width, myObj.ActiveComp.height, myObj.ActiveComp.pixelAspect, myObj.ActiveComp.duration);
Controler.transform.opacity.setValue(0);
Controler.adjustmentLayer = true;
// adding sliders control to controler
var SliderOne = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
var SliderTwo = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
var SliderThree = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
SliderOne.property("ADBE Slider Control-0001").setValue(20);
SliderOne.name = "First Opacity";
SliderTwo.property("ADBE Slider Control-0001").setValue(20);
SliderTwo.name = "Second Opacity";
SliderThree.property("ADBE Slider Control-0001").setValue(20);
SliderThree.name = "Third Opacity";
But if I write the code this way, it works:
Code: Select all
var Controler = myObj.ActiveLayers.addSolid([1,1,1], "Controler", myObj.ActiveComp.width, myObj.ActiveComp.height, myObj.ActiveComp.pixelAspect, myObj.ActiveComp.duration);
Controler.transform.opacity.setValue(0);
Controler.adjustmentLayer = true;
// adding sliders control to controler
var SliderOne = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
SliderOne.property("ADBE Slider Control-0001").setValue(20);
SliderOne.name = "First Opacity";
var SliderTwo = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
SliderTwo.property("ADBE Slider Control-0001").setValue(20);
SliderTwo.name = "Second Opacity";
var SliderThree = Controler.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
SliderThree.property("ADBE Slider Control-0001").setValue(20);
SliderThree.name = "Third Opacity";
For exemple, try adding after the second code this line and the execution will fail:
Code: Select all
alert(SliderOne.name);
Any hints ?