Fireworks中Distribute to Layers脚本的改进
增加功能:
将元素分层时,新建层按照分配的元素名称命名。而不是默认的 “layer *”
修改:
X-shy (www.mobiusclub.com)
2003.08
脚本安装:
请将以下文本保存成文本文件:“Distribute to Layers (X-shy).jsf” ,将文件放到“\Fireworks MX\Configuration\Commands\Document”下,重新启动fireworks即可在菜单“Commands\Document”下访问本功能
----------------------------------- Jsf 文件内容 -------------------------------------------------------------------------
// DistributeToLayers.jsf
// This command will take multiple objects and move them to indivual layers
// Copyright (c) 2000 Macromedia. All rights reserved.
// Save the current frame in the document
var curFrameNum = fw.getDocumentDOM().currentFrameNum;
// get the total layers minus the web layer
var numLayers = fw.getDocumentDOM().layers.length-1; // skip the web layer.
var curLayerNum;
// loop through the current number of layers
for (curLayerNum = numLayers-1; curLayerNum >= 0; curLayerNum--) {
// get the current layer
var curLayer = fw.getDocumentDOM().layers[curLayerNum];
// get the elements on the current layer
var elements = curLayer.frames[curFrameNum].elements;
// get the number of elements
var numElements = elements.length-1;
var i;
var Layername; //Add By X-shy From:www.mobiusclub.com
// loop through the number of elements
for (i=0; i
// get the current layer number
if (i==0) fw.getDocumentDOM().currentLayerNum = curLayerNum;
//Get the element's name
Layername = curLayer.frames[curFrameNum].elements[numElements-i-1].name;
// add layers for the number of elements,New layer named by Layername
fw.getDocumentDOM().addNewLayer(Layername, true);
}
// again loop through the number of elements
for (i=0; i // set the current layer
curLayer = fw.getDocumentDOM().layers[curLayerNum];
// get the elements on the current layer
elements = curLayer.frames[curFrameNum].elements;
// select none
fw.getDocumentDOM().selectNone();
// create a new array that will hold the selection
var sel = new Array();
// populate the array
sel[0] = elements[elements.length-2];
// select all of the elements of the array in Fireworks
fw.selection = sel;
// move the selection to its new layer
fw.getDocumentDOM().moveSelectionToLayer(curLayerNum+i+1, false, "none", -1);
}
}
www.mobiusclub.com/down/down/DistributetoLayers(X-shy).rar