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?
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?