This is pretty close to what you need. It will convert all selected bitmaps to movieclips. The only difference is that you have to manually import the images to the stage. Then select them and run this script.
Also, it will add "bit" before the name and also strip the file extension. For instance: "background.jpg" becomes "bit - background" and the linkage is "bit_background". (You can change it to "mc" and "mcID" if you wish.)
So, copy this code and save it in a ".jsfl" file in the "Commands" folder. Enjoy!
Code:
// ----------------
// BITMAP TO SYMBOL
// ----------------
//
// VERSION: 1.1
// DATE: 9/18/06
//
// HOTKEY:
if (fl.getDocumentDOM() == null) {
fl.trace("Error: No document open.");
} else {
if (fl.getDocumentDOM().selection.length == 0) {
fl.trace("Error: Nothing selected.");
} else {
var selArr = fl.getDocumentDOM().selection;
for (var i = 0; i < selArr.length; i++) {
var instanceRef = selArr[i]
if (instanceRef.instanceType == "bitmap") {
// Only convert selected bitmaps.
var libraryItemRef = instanceRef.libraryItem;
var newName = "bit - " + stripExtension(libraryItemRef.name);
fl.getDocumentDOM().selectNone();
fl.getDocumentDOM().selection = new Array(instanceRef);
var mc = fl.getDocumentDOM().convertToSymbol("movie clip", newName, "top left");
if (mc == null) {
// Throws an error, on screen anyway...
fl.trace("Error: Couldn't convert "+newName+" to symbol.");
}
// Set linkage data
mc.linkageExportForAS = true;
mc.linkageExportInFirstFrame = true;
mc.linkageIdentifier = "bit_" + stripExtension(libraryItemRef.name);
}
}
fl.getDocumentDOM().selectNone();
}
}
function stripExtension(str) {
var pos = str.lastIndexOf(".");
if (pos == -1) {
return str;
} else {
return str.slice(0,pos);
}
}