I got this to work properly. A little different setup. First adding all sliders at once and naming them, which I think may have been causing your code confusion since it saw the exact same slider names.
//START?????????????????
var myLayer = app.project.item(1).layer("Black Solid 1");
var sliderNames = new Array("RED", "GREEN");
var sliderControls;
for(var i=0; i<2; i++){
sliderControls = myLayer.Effects.addProperty("Slider Control");
sliderControls.name = sliderNames[i];
}
var RED_Slider = myLayer.property("ADBE Effect Parade").property("RED").property("ADBE Slider Control-0001");
var GREEN_Slider = myLayer.property("ADBE Effect Parade").property("GREEN").property("ADBE Slider Control-0001");
RED_Slider.setValue([10]);
GREEN_Slider.setValue([20]);
var red = RED_Slider.value;
var green = GREEN_Slider.value;
alert(green);
//END?????????????????
--
David Torno
Visual Effects Artist and Supervisor
http://www.ghosttownmedia.comdavid@ghosttownmedia.com
O: 213.739.2290
C: 818.391.6060
------------------------------------------------
http://www.sydefxink.com (main portfolio)
http://aeioweyou.blogspot.com (vfx tutorials and AE scripts blog)
http://mactex.blogspot.com (free textures blog)
-----Original Message-----
From: Phil Spitler [mailto:phil@bonfirelabs.com]
Sent: Thursday, January 10, 2013 08:14 AM
To: 'After Effects Mail List'
Subject: Re: [AE] Script Question
Yup 2 sliders to the same layer.
Phil
Phil Spitler | Creative Technologist | Bonfire Labs | t : 415.394.8200 | c : 415.571.3139 | Bonfirelabs.com
"Get Social" - http://www.facebook.com/bonfirelabs
On Jan 9, 2013, at 11:33 PM, David Torno <torno@sydefxink.com> wrote:
Wait I just realized something, are you adding two sliders to the same layer?
David Torno
Visual Effects Artist & Supervisor
http://www.ghosttownmedia.com
O: 213.739.2290
C: 818.391.6060
---------------------
http://www.sydefxink.com
http://aeioweyou.blogspot.com
http://mactex.blogspot.com
"The most useless day is that in which we do not laugh"
-Charles Field
On Jan 9, 2013, at 11:02 PM, Phil Spitler <phil@bonfirelabs.com> wrote:
I'm having a fun time figuring out a scripting problem and thought I would ask the advice of the script gurus on the list.
Basically I want to add 2 sliders then get the value of those sliders.
var RED_Slider = selectedLayer.Effects.addProperty("Slider Control");
var red = RED_Slider(1).value;
var GREEN_Slider = selectedLayer.Effects.addProperty("Slider Control");
var green = GREEN_Slider(1).value;
If I run the code above, it works great however if I change the order and assign the sliders first then try to get the value, AE gives me an "invalid object" error.
So the code below will not work.
var RED_Slider = selectedLayer.Effects.addProperty("Slider Control");
var GREEN_Slider = selectedLayer.Effects.addProperty("Slider Control");
var red = RED_Slider(1).value;
var green = GREEN_Slider(1).value;
It's almost as if when I add the Green Slider, it forgets the Red Slider.
Any ideas?
Cheers.
Phil
Phil Spitler | Creative Technologist | Bonfire Labs | t : 415.394.8200 m : 415.571.3139
Website | Facebook | LinkedIn
+---End of message---+
To unsubscribe send any message to <ae-list-off@media-motion.tv>