PDA

Click to See Complete Forum and Search --> : getURL() in a Flash projector fails in Firefox


juls034
10-28-2007, 02:50 AM
I'm attempting to link to a PDF file from a disc containing the exe. file on the same level (no folders) when the users default browser is set to Firefox, using the actionscript (2.0) below:

on (release) {getURL("_filename.pdf", "_blank");

}

The getURL function won't work in Firefox. It only works with Firefox if there is a page already opened; but not when the getURL launches Firefox to open the pdf file.

I researched this and the problem is based on how Firefox handles a url which is passed to it as a command-line parameter. To work around this problem I substituted the actionscript for this (something I found online):

var swfUrl:String = _root._url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex >= 0)
{
baseUrl = swfUrl.substring(0, pipeIndex);
baseUrl += ":";
}
else
{
baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex + 1, lastSlashIndex + 1);

myButton.onRelease = function()
{
var targetUrl:String = baseUrl + "_filename.pdf";
getURL(targetUrl, "_blank");
};


The above script didn't work. Has anyone else run into this problem with the gerURL commmand when the default browser is Firefox?

Drazan
10-28-2007, 04:41 AM
yep known problem. I usually work with CD based flash applications. And there I use fscommand to lauch an application to show the pdf.

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14280&sliceId=1

Then place an filename.exe file and the filename.pdf file in the fscommand directory to launch . This is a security measure. Also the two names must be identicle to work.