ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

add a definied comp in another comp with javascript

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
phil largilliere
add a definied comp in another comp with javascript
on Apr 11, 2016 at 9:27:37 am

Hi every one

I wrote a script where I create a new comp, then I want to import a definied comp in this new one, but I can't find the way to do this.

myProject = app.project;
myProject.items.addComp("surComp",1920,1080,1,15,25);

var myComp = new Array();
for (i=1; i <= myProject.numItems; i++)
{
if (myProject.item(i).name == "Comp 1")
{ myCompNum = i - 1;
}
}

for (i=1; i <= myProject.numItems; i++)
{
if (myProject.item(i).name == "surComp")
{
myProject.item(i).openInViewer();
//Add "Comp 1" as layer in this new Comp ???
}
}


Can you help me ??

Thank you so much
PH...


Return to posts index

Walter Soyka
Re: add a definied comp in another comp with javascript
on Apr 11, 2016 at 10:13:53 am

You use the .add() method of a LayerCollection:


myProject = app.project;
surComp = myProject.items.addComp("surComp",1920,1080,1,15,25);

var myComp = new Array();
for (i=1; i <= myProject.numItems; i++)
{
if (myProject.item(i).name == "Comp 1")
{ comp1 = myProject.item(i);
}
}

surComp.openInViewer();
comp1Layer = surComp.layers.add(comp1);


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

phil largilliere
Re: add a definied comp in another comp with javascript
on Apr 11, 2016 at 10:32:47 am

Thank you !!

it works perfectly well !! I use to write this code, but I don't know why it doesn't work. Thanks again ;)


Return to posts index

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