PDA

View Full Version : Finding bitmap path


bithlo_tec
12-13-2007, 03:15 PM
Does anyone know how to find the source file path of a bitmap in the library using JSFL?

bithlo_tec
12-14-2007, 01:11 PM
tear.....

iliketheska
12-14-2007, 07:41 PM
I've never looked into that, but couldn't you put your bitmaps into the same folder as your .fla and use that?
This gives you a usable folder URI:

var doc = fl.getDocumentDOM();
var fileName = doc.name;
var filePath = doc.path;
function getFolderURI() {
//get filename without extention:
aFile = fileName.split(".");
//get filepath without filename:
aPath = filePath.split(fileName);
//make a valid path:
folderURI = aPath[0];
folderURI = replaceStr(folderURI, "\\", "/");
folderURI = replaceStr(folderURI, " ", "%20");
folderURI = replaceStr(folderURI, ":", "|");
folderURI = "file:///"+folderURI;
return folderURI;
}
// The rest of this is a string replacement function
function replaceStr(origStr, searchStr, replaceStr) {
var tempStr = "";
var startIndex = 0;
if (searchStr == "") {
return origStr;
}
if (origStr.indexOf(searchStr) != -1) {
while ((searchIndex=origStr.indexOf(searchStr, startIndex)) != -1) {
tempStr += origStr.substring(startIndex, searchIndex);
tempStr += replaceStr;
startIndex = searchIndex+searchStr.length;
}
return tempStr+origStr.substring(startIndex);
} else {
return origStr;
}
}

so then you could add onto that the bitmap.jpg or whatever.
Hope this helps?

bithlo_tec
12-17-2007, 01:50 PM
Actually the reason I am doing this is to find where the bitmaps are, not so much how to create a path.

I am working on a project with hundreds of .flas and we are required to give a list of file names and source paths of all the bitmaps and movs that were used in each flash file, and of course they not all from the same directories.

I am, however, working on another command which is going to need something similar to code you provided.

Thanks, I really appreciate the reply.