0

此代码无法在 Mac OS 上的 AIR 应用程序中打开 PDF 文件。但是相同的代码在 Windows 中也能正常工作。我安装了adobe acrobat reader。但我仍然在 MAC os 中遇到错误

受保护的功能 button2_clickHandler(event:MouseEvent):void

        {





            if (HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK){



            var FileDir:File =new  File();

            var FilePath:String = "";               



            try

            {

                // Open browser for choose pdf file for open

                FileDir.browseForOpen("Open As [Only supports .PDF extension with file name.]");



                FileDir.addEventListener(Event.SELECT, readFromDirectory);

                //htmlLoader.parent.removeChild(htmlLoader);

            }

            catch (error:Error)

            {

                trace("Failed:", error.message);

            }



            //***** Browse event complete *****

            function readFromDirectory(event:Event):void

            {   

                try

                {           

                    var newFile:File = event.target as File;

                    FilePath =  newFile.nativePath;



                    var url:URLRequest = new URLRequest(FilePath); //URL to the file                      



                    htmlLoader.width = 700; //width of the content area



                    htmlLoader.height = 450; //height of the content area



                    htmlLoader.load(url);



                    //wrapping into UIComponent                   



                    holder = new UIComponent();                       

                    holder.addChild(htmlLoader);

                    addElement(holder);              



                }

                catch(err:Error)

                {

                    trace("file not in correct format");

                }

            }   

            }               

        }
4

1 回答 1

0

尝试在您的 Mac 上安装 Acrobat Reader。

于 2014-01-11T12:40:09.663 回答