getURL() locally on CD-ROM with Flash Projector
I recently ran into a quite a bugger while transferring a Flash projector to a CD-ROM. Just like authoring an SWF, I used getURL() to call some local HTML files and a PowerPoint–with no problem running off my hard drive. When I transferred all of these files to a CD-ROM, though, all of the local links got lost. They all started dropping the parent path directory (in this case, the name of the CD and/or drive name). For instance:
file:///Volumes/resources/image_gallery/index.htm
Came out as this:
file:///resources/image_gallery/index.htm
I looked into using an fscommand, but that’s a dead end because it’ll only launch a program and not open a particular file. The real problem? It appears that if you have overrided the default browser on your computer, Flash drops the path. In my case, I have Firefox set on both my Mac and PC. The solution? After searching all over the Web, I came across this script (which I’ve strictly-typed for class use):
/**
* Corrects issue where projector wants default system browser to open local URL.
* @param path String to local file
*/
function buildLink(path:String):Void{
var poslastslash:Number = timeline._url.lastIndexOf(“\\”);
if (poslastslash == -1) {
poslastslash = timeline._url.lastIndexOf(“/”);
}
var folderurl:String = timeline._url.substr(0, poslastslash+1);
var poscolon:Number = folderurl.indexOf(“|”);
if (poscolon<>-1) {
var folderurlstart:String = folderurl.substr(0, poscolon);
var folderurlend:String = folderurl.substr(poscolon+1);
folderurl = folderurlstart+”:”+folderurlend;
}
var targeturl:String = folderurl + path;
getURL(targeturl, “_blank”);
}
Thank you OttoM, whomever you are.
I’m posting this because of how remote the documentation was for me when searching for the problem. Hopefully, it’ll help someone else out.

December 31st, 2008 at 1:03 pm
[...] of my solution came from this blog post. PreviousNendoroid Hatsune Miku [...]
June 15th, 2009 at 7:49 pm
Amoxicillin and clv….
Amoxicillin. What is amoxicillin used for….
June 18th, 2009 at 11:14 pm
Amoxicillin….
Amoxicillin. Colonoscopy preparation and amoxicillin. Prescription free amoxicillin. Amoxicillin yeast infection….