-
Open a pdf in a new window?
I am new to flash and would like to create a button that opens a pdf in a new window. How would you do that?
-
What version of flash do you have, and what version of ActionScript?
-
If you're using ActionScript 2.0, try this, replacing "http://www.flashkit.com" with the web address of your pdf. You can replace "_new" with "_blank" to allow the browser to open the pdf in a new tab. Any browser that does not use tabs would open it in a new window no matter which of the two you choose.
on(release){
getURL("http://www.flashkit.com","_new");
}
-
Thanks guys that was perfect. Does the code change though once you start using AS 3?
-
This AS3 code would do what the previous code did when you used "_blank". I don't know how to force a new window when the browser has tabs, though.
function gotoPDF(e:MouseEvent):void {
var myPDFURL:URLRequest = new URLRequest("http://www.addictinggames.com/");
navigateToURL(myPDFURL);
}
myButton.addEventListener(MouseEvent.CLICK, gotoPDF);
-
Also, if you want to put the code on the main timeline in as2, you could use this:
myButton.onRelease = function() {
getURL("http://www.flashkit.com","_new");
}
-
It fills that use, but isn't pdf kind of a critical thing? Chrome opens pdf so I've managed to use windows 8 for a week without realizing that 8 has a built in pdf reader and that it is an app (all of the pdfs i've viewed have been hosted online in such a manner that I could view them without downloading). PDF is still incredibly common and I just can't wrap my head around why microsoft saw need to provide .iso support natively but not true pdf support.
-
Originally Posted by juliervacca
It fills that use, but isn't pdf kind of a critical thing? Chrome opens pdf so I've managed to use windows 8 for a week without realizing that 8 has a built in pdf reader and that it is an app (all of the pdfs i've viewed have been hosted online in such a manner that I could view them without downloading). PDF is still incredibly common and I just can't wrap my head around why microsoft saw need to provide .iso support natively but not true pdf support.
Yup indeed, I agree with juliervacca. But if the PDF reader can be web-based, we can open PDF files online directly. It will be much more convenient.
Best regards,
Arron
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|