why var sth twice?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
msongz
Posts: 7
Joined: January 9th, 2011, 9:45 am

it runs correctly,but ...

why i must var the sL twice?

Code: Select all

app.beginUndoGroup("Precomp by songZ")

var aI = app.project.activeItem ;



function eR() {
    
    if ( !(aI instanceof CompItem)) {
        
        alert ("选一个合成!","Precomp by songZ","x")
        
        }else{
            
            pC () ;
        }
}


function pC() {


var sL = aI.selectedLayers ;
    
    if (aI.numLayers == 0) {alert ("没有图层!","Precomp by songZ","x"); }
    else if (sL.length == 0) {for (t=1 ; t <= aI.numLayers ; t++) {aI.layers[t].selected = true ; }}
    
  var sL = aI.selectedLayers ;

    var sLn = sL.length-1 ;

    for(i = 0 ; i <= sLn ; i++) {

    var slAry = new Array() ;

    slAry[0] = sL[i].index ;

    aI.layers.precompose(slAry, sL[i].name, false) ; 
    }
        for (t=1 ; t <= aI.numLayers ; t++) {aI.layer(t).label =aI.layer(t).index %16;
        //aI.layers[t].selected = false ; 
        }
    }


eR()






















app.endUndoGroup()
Post Reply