Warning: Parameter 1 to multibyte_patch::wplink_js() expected to be a reference, value given in /home/yoropan/yoropan.com/public_html/en/wp-includes/plugin.php on line 579

Warning: Parameter 1 to multibyte_patch::word_count_js() expected to be a reference, value given in /home/yoropan/yoropan.com/public_html/en/wp-includes/plugin.php on line 579

Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /home/yoropan/yoropan.com/public_html/en/wp-includes/plugin.php on line 579

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /home/yoropan/yoropan.com/public_html/en/wp-includes/plugin.php on line 579
Yoropan blog » Fireworks command : select slices by color
2012
08.28

From Fireworks CS6, it can export CSS sprites. When export slices, I want to select separately these slices. so, slices group by color, slices can select separately.
you know slices can change color?

Of course this command can use even below Fireworks CS6.
If you decide the rules, looks as well as practical.

After this command run, If slices that exists across all pages, it’ ok.
This command look for the same color slices from all pasges.

Then export slices as usual.
Check options at the export dialog.
Select “All Pages” in “Pages:” combobox, and check the “Selected Slices Only” checkbox.

samecolor_sliceselect.jsf

jsf code:

try {
	if (fw.documents.length != 0) {
		var dom = fw.getDocumentDOM();
		var sel = fw.selection;

		var len = sel.length;

		if (len == 0) {
			alert("select something.")
		} else {

			if (sel[0].sliceID) {
				var pnum = fw.getDocumentDOM().pagesCount;
				var pno = fw.getDocumentDOM().currentPageNum; 
				var _color = sel[0].color;
				var slices;
				
				for (var h = 0; h < pnum; h++) {
					fw.getDocumentDOM().changeCurrentPage(h);

					var l = fw.getDocumentDOM().layers;
					var len = l.length - 1;
					
					fw.getDocumentDOM().currentLayerNum = len;
							fw.getDocumentDOM().selectAllOnLayer(len, false, false);
							 slices = [];
							slices = slices.concat(fw.selection);
			
							var j = slices.length;
			
							if (slices) {
								for (var i = 0; i < j; i++) {
									
									if (_color != slices[i].color) {
										slices[i]=null;
									}
								}
							}
							fw.selection=slices;
				}
				fw.getDocumentDOM().changeCurrentPage(pno);
			}


		}

	} else {
		alert("No documents")
	}
} catch (e) {
	alert(e)
}

No Comment.

Add Your Comment

%d人のブロガーが「いいね」をつけました。