Provided by Mirko Sabljic, this JSFL command script allows you to set AllowSmoothing to all bitmaps in library. It’s pretty usefull thing if you decide to take that step with your bitmaps in Flash.
code is very simple, but I’ve never had found any good resource for JSFL variable and other definitions.
Anyway Mirko did wonderfull job – script is available via download here
Code :
var libItems = fl.getDocumentDOM().library.items;
for (i = 0; i < libItems.length; i++){
if(libItems[i].itemType == “bitmap”){
libItems[i].allowSmoothing = true;
libItems[i].compressionType = “lossless”;
}
}
to run the script you can go to Commands > Run Command and then browse for this JSFL
you can also copy this JSFL file to the
Flash_root_folder/en/First Run/Commands to get it in Commands menu
edit :
if you want to set images to JPEG Compression you can change line
libItems[i].compressionType = “lossless”;
with
libItems[i].compressionType = “photo”;
libItems[i].quality = 70; //specify custom quality if you want














16 responses so far ↓
electric bigfoot // June 25, 2007 at 6:18 pm |
dude! you are a life-saver. I am the lead of a flash development team that works in HEAVY volumes of bitmaps that need to be scaled and this script is going to save us so much time. Thanks so much!
mrsteel // June 25, 2007 at 6:23 pm |
thanx and thanks go to Mirko too
please send me your work when you finish so I can possible feature it on few forums and sites
good luck on your work !
gia // October 10, 2007 at 6:05 am |
Many thanks!!!!!!
gorjan // October 10, 2007 at 10:12 am |
Thank you, very useful.
mrsteel // October 10, 2007 at 11:05 am |
if you have any suggestions for JSFL code snippets just let me know
thanks
Jacob // November 8, 2007 at 12:00 am |
He’s a couple years late – I did this back in early 2005 and gave them out during a FlashForward conference seminar
mrsteel // November 8, 2007 at 12:47 am |
yea I am
but still it’s good thing it helped somebody ;
gameotry // November 14, 2007 at 1:43 am |
bless you
ottosuke // May 6, 2008 at 11:12 pm |
Thank you very much for your help
otto
Thailand
Jeremy Daley // June 27, 2008 at 3:01 pm |
something like this is a little better, allowing you to turn smoothing back off, as well as only apply it to items that you have selected in the library:
var promptVal = prompt(”Allow Smoothing? (1=Yes, 0=No)”, “1″);
var theLibrary = fl.getDocumentDOM().library;
var selectedItems = theLibrary.getSelectedItems();
fl.outputPanel.clear();
for(var itemIndex=0; itemIndex < selectedItems.length; itemIndex++){
var theItem = selectedItems[itemIndex];
theItem.allowSmoothing = (promptVal==”1″) ? (true) : (false);
var itemName = theItem.name;
var enableDisable = (promptVal==”1″) ? (”Enable”) : (”Disable”);
var outputString = enableDisable + ” smoothing on: ” + itemName;
fl.outputPanel.trace(outputString);
}
fl.outputPanel.trace(”Smoothing Complete!”);
mrsteel // June 29, 2008 at 7:21 pm |
cool
thanks very much for posting!
brgds
Mirko // July 19, 2008 at 8:00 pm |
Glad you like it guys, it saved me a looot of time.
@Jacob
Unfortunatelly i didn’t attend your seminar back then
L // July 23, 2008 at 5:11 am |
cheers for the code man i used for some files with hundreds of bitmaps in Library so it saved me hours if not days. I removed the bit that sets compression as i prefer to do this in publish settings that apply for all so its easy to change that setting later when compressing the final swf.
@Jeremy
Why is it a problem to Allow Smoothing to all? ..sorry but i fail to see that your code is better its just more complex to use when you have to sit and select them first. Or am i missing something here? why would i want to turn it back off again?
ali // August 19, 2008 at 4:56 pm |
fortunately I get rid of doing these steps one by one…great job man…thanks a lot
bioillogic // August 29, 2008 at 12:18 am |
SEI UN GENIO!
Mark // April 15, 2009 at 10:05 pm |
Great work here. I had one question about modifying this. How would I reference the “Use document default” check box that is below the “Allow Smoothing” in the properties? Here’s what I have tried thus far:
libItems[i].useDocumentDefaultQuality = true;
It didn’t work, but I wonder if I’m most likely referencing it incorrectly. Any ideas?