-
Is it possible to return a layer from a function ?
Hi everyone,
I am loosing my layer when I return it from a function…
I created the layer variable outside the function and fed it as an argument.
I can access it’s info in the function until I put in : “return BpcNull;”
I can never access it’s info outside the function, even if I take away the return line ( I then never tell the script what the variable is outside the function )Anyone see what’s wrong ?
Thx !
Here’s my code and function (just took away the long expressions) :CODE :
var BpreNull;
CreatepcNull(BpreNull, curBtwnComp, curBtwnComp.duration, BdestComp, q, threeD, BcName, BpreName);
alert(BpreNull.name);FUNCTION :
function CreatepcNull(BpreNull, BnewComp, BncDuration, BdestComp, q, threeD, BcName, BpreName){
var BpcNull = BnewComp.layers.addNull(BncDuration);
BpreNull = BnewComp.layers.addNull(BncDuration);
BpreNull.name = “Ctrl_Light_” + (q+1);
BpreNull.parent = BpcNull;if(threeD == true){
BpcNull.threeDLayer = true;
BpreNull.threeDLayer = true;
};var BpcNullPos = BpcNull.property(“ADBE Transform Group”).property(“ADBE Position”);
var BpcNullAnchor = BpcNull.property(“ADBE Transform Group”).property(“ADBE Anchor Point”);
BpcNullAnchor.setValue(BpcNullPos.value);
var BpcNullScale = BpcNull.property(“ADBE Transform Group”).property(“ADBE Scale”);
var BpcNullRot = BpcNull.property(“ADBE Transform Group”).property(“ADBE Rotate Z”);
BpcNullRot.expression = ‘…’;
BpcNullScale.expression = ‘…’;
BpcNullAnchor.expression = ‘…’;
return BpreNull;
};