flash as 将图片批量导入到位一帧

作者:袖梨 2022-07-02

fl.getDocumentDOM().getTimeline().currentFrame = 0;
fl.getDocumentDOM().selectAll()
fl.outputPanel.clear()
fl.getDocumentDOM().distributeToLayers();
var myLayers=fl.getDocumentDOM().getTimeline().layers
fl.getDocumentDOM().selectNone();
var obj={}
for(var i=0;i {
        if(myLayers[i].frames[0].elements.length>0)
        {
                var key=myLayers[i].name.slice(0,myLayers[i].name.length-7)
                obj[key]==undefined?obj[key]=[]:'';
                obj[key].push([myLayers[i].name,i])
        }
       
}
var items=new Array()
for(var k in obj)
{
        obj[k].sort();
        var name;
        for(var v=0;v         {
                fl.getDocumentDOM().selection=myLayers[obj[k][v][1]].frames[0].elements
                name=obj[k][v][0]
                }
                fl.getDocumentDOM().convertToSymbol('movie clip',name.slice(0,name.length-7), 'bottom center');
                var lib = fl.getDocumentDOM().library;
                lib.setItemProperty('linkageExportForAS', true);
                lib.setItemProperty('linkageExportInFirstFrame', true);
                fl.getDocumentDOM().enterEditMode('inPlace');
               
               
                //alert(b);


                fl.getDocumentDOM().distributeToLayers();
                var elementLayers=fl.getDocumentDOM().getTimeline().layers
                var elements=new Array
                for(var loc_1=0;loc_1                 {
                        if(elementLayers[loc_1].frames[0].elements.length==0)
                        {
                               
                                fl.getDocumentDOM().getTimeline().setSelectedLayers(0);
                                fl.getDocumentDOM().getTimeline().setSelectedFrames(0,0);
                               
                fl.actionsPanel.getScriptAssistMode();
                var b=fl.actionsPanel.setText("stop();")
                                fl.getDocumentDOM().getTimeline().insertKeyframe(1)
                                fl.getDocumentDOM().getTimeline().insertKeyframe(2)
                                fl.getDocumentDOM().getTimeline().insertKeyframe(3)
                               
                        }else {
                                elements.push([elementLayers[loc_1].name,loc_1])
                                }
                }
                elements.sort();
                var frame=0
                for(var loc_2=0;loc_2<4;loc_2++)
                {
                        if(frame                         {

                               
                               
                                 fl.getDocumentDOM().getTimeline().setSelectedLayers(elements[loc_2][1]);
                                 fl.getDocumentDOM().getTimeline().setSelectedFrames(0,0);
                                 fl.getDocumentDOM().getTimeline().cutFrames(0);
                               
                        }else {
                                if(elements.length==2&&frame>1){
fl.trace(frame+'---'+elements.length)
                                        if(frame==2){
                                         fl.getDocumentDOM().getTimeline().setSelectedLayers(0);
                                         fl.getDocumentDOM().getTimeline().setSelectedFrames(0,0);
                                          fl.getDocumentDOM().getTimeline().copyFrames(0);
                                        }else if(frame==3){
                                         fl.getDocumentDOM().getTimeline().setSelectedLayers(0);
                                         fl.getDocumentDOM().getTimeline().setSelectedFrames(1,1);
                                         fl.getDocumentDOM().getTimeline().copyFrames(1);

                                        }
                                }
                        }
                        fl.getDocumentDOM().getTimeline().setSelectedLayers(0);
                        fl.getDocumentDOM().getTimeline().setSelectedFrames(frame,frame);
                        fl.getDocumentDOM().getTimeline().pasteFrames(frame);
                       
                        frame+=1
                }
                        var arr=fl.getDocumentDOM().getTimeline().layers
                        for(var loc_4=1;loc_4                         {
                                        fl.getDocumentDOM().getTimeline().setSelectedLayers(1);
                                        fl.getDocumentDOM().getTimeline().deleteLayer(1);
                        }
       
                fl.getDocumentDOM().exitEditMode();

                fl.getDocumentDOM().selectNone();

        }
        for(var i_2=1;i_2         {
                fl.getDocumentDOM().getTimeline().setSelectedLayers(1);
                fl.getDocumentDOM().getTimeline().deleteLayer(1);
       
        }
        fl.getDocumentDOM().exportSWF(" http://www.111com.net
/elementsLibs.swf ");

相关文章

精彩推荐