Adding an effect to a set position

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

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
Phil Spitler
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

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.
Post Reply