Page 1 of 1

Adding an effect to a set position

Posted: February 8th, 2012, 9:52 pm
by philspitler
I want to add an effect to some layers in an AE script but instead of it adding it to the bottom of the property group, I want to insert it at a set location.

Here is my current code snippet.

Code: Select all

if (thisEffectName == fxOld) { // found an old effect
                                   thisEffect.remove();
                                   currentEffects.addProperty(fxNew);
                                   } 

Like I said, it works great other than it adds the new effect to the bottom of the group.

Any ideas?

Thanks.

Phil

Re: Adding an effect to a set position

Posted: February 12th, 2012, 4:45 pm
by lloydalvarez
Use the moveTo() method:

PropertyBase moveTo() method
app.project.item(index).layer(index).propertySpec.moveTo(newIndex)

Description
Moves this property to a new position in its parent property group.
This method is valid only for children of indexed groups; if it is not, or if the index value is not valid, the method generates an exception and displays an error. (An indexed group has the type Proper- tyType.INDEXED_GROUP; see “PropertyBase propertyType attribute” on page 145.)

Parameters
newIndex - The new index position at which to place this property in its group. An integer.

Returns
Nothing.