Hi Phil,
when you add a new slider, the variables pointing to other sliders
get invalid and you should not use them anymore.
See in the scripting guide the section "Reference Invalidation" of
the PropertyBase object.
You need to create a new variable pointing to the RED Slider after
creating the other one. You can do this by remembering either the
index or the name of the red slider (This is the solution that
David suggested).
Best,
Mathias
mamoworld.com
tools & tutorials for After Effects
dr. mathias möhl
kapellenweg 36, 79100 freiburg, germany
phone +49 (0)761 - 4774 584
info@mamoworld.com
Am 11.01.2013 00:00, schrieb After Effects Mail List:
From: Phil Spitler <phil@bonfirelabs.com>
Subject: Script Question
Date: Wed, 9 Jan 2013 23:02:33 -0800
Message-Id: <10BF9340-252E-4EFA-9959-BA5AE8B7FB00@bonfirelabs.com>
--Apple-Mail=_D3C13877-1DE8-4235-9E78-3B04DBB097EA
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
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 =3D selectedLayer.Effects.addProperty("Slider =
Control");
var red =3D RED_Slider(1).value;
var GREEN_Slider =3D selectedLayer.Effects.addProperty("Slider =
Control");
var green =3D 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 =3D selectedLayer.Effects.addProperty("Slider =
Control");
var GREEN_Slider =3D selectedLayer.Effects.addProperty("Slider =
Control");
var red =3D RED_Slider(1).value;
var green =3D 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