Mailing List AE-List@media-motion.tv ? Message #47320
From: David Torno <torno@sydefxink.com>
Subject: Re: [AE] Script Question
Date: Wed, 9 Jan 2013 23:31:10 -0800
To: After Effects Mail List <AE-List@media-motion.tv>
Not sure I fully understand, but I do think what is causing the error is that the "selectedLayer" is changed if you add a layer then add another just after it. So when you added a slider, saved it's value, the code was able to associate each grouping you scripted. 

Hopefully that made sense? :)

David Torno
Visual Effects Artist & Supervisor
O: 213.739.2290
C: 818.391.6060
---------------------
http://aeioweyou.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










 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster