Skip to main content
April 23, 2010
Question

How do I open an external pdf file with AS3?

  • April 23, 2010
  • 1 reply
  • 4876 views

I've searched and found this code:

import flash.net.navigateToURL;
import flash.net.URLRequest;

myButton.addEventListener(MouseEvent.CLICK, goPDF);

function goPDF(event:MouseEvent):void {
var url:String = "OAI/InsuranceDiagnosticCodes.pdf";
var request:URLRequest = new URLRequest(url);
navigateToURL(request);
}

but nothing happens when I click on the button.

What am I dong wrong? Btw, I'm relatively new to Flash CS4 and AS3.

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 23, 2010

That code should be okay.  Have you tried it online at all?  REgarding the button, how is it situated in the timeline and where is that code?

PS - those particular classes, and most others commonly used like them, do not need to be imported.  The compiler will usually complain when you try using something that needs to be imported.

Participant
April 25, 2010

Hi,

can I modify this code here to open a VOB in Windows Media Player?

I created a button in Flash CS4...

Malcolm

mangamalcolm@hotmail.com