ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

replaceFootage problem

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Arturo Bracero
replaceFootage problem
on Nov 18, 2019 at 2:48:15 am

Hello, I have a script that imports a bunch of files, creates folders and subfolders and changes comp names. So far so good, but the problem is that I also want to change one of the layers (a picture) and replace it, on each composition, with a specific picture.

I have several functions to get the layers that should be replaced and the FootageItems that they should be replaced with. However, this doesn't seem to work with replaceSource (I get an Function item.layer is undefined error).

If i explicitly declare the project item and the project layer, the replacement works, but I need to get these from functions that return the objects.

I have attached a simplified version of the code that gives me the same error.

Thank you very much.

var myProject = app.project;
var item = myProject.item(1);
var layer = item.layer(1);
var replace = myProject.item(2);

layer.replaceSource (replace, false);


Return to posts index

Oleg Pirogov
Re: replaceFootage problem
on Nov 18, 2019 at 11:41:47 am

This may happen if after importing files and creating folders your comp's index has changed and item(1) now is not a comp but some footage or folder (which don't have a layer() function and thus the error).


Return to posts index

Arturo Bracero
Re: replaceFootage problem
on Nov 18, 2019 at 3:20:28 pm

This is not the case, as no new items are being created in this test code.

Also, as a side note, in the code of the original post, if the var is not named "item" (which could cause some confusion) I still get the same error.


Return to posts index


Oleg Pirogov
Re: replaceFootage problem
on Nov 18, 2019 at 6:27:19 pm

Have you checked if the comp is really the item(1)?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]