1

我有 HTMLLoader 可以正确加载 pdf 文件,但我的问题是 HTMLloader 没有出现 pdf 的完整宽度(尽管我更改了 HTMLLoader 宽度,但 pdf 的 Vscroll 没有出现)。

private var pdf:HTMLLoader = new HTMLLoader();     
        private function init():void {
            if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK)  
            { 
                var request:URLRequest = new URLRequest("file:///D:/New%20folder/%D8%A7%D9%84%D9%83%D8%AA%D8%A7%D8%A8%20%D8%A7%D9%84%D8%AA%D9%81%D8%A7%D8%B9%D9%84%D9%8A/home.pdf");

                pdf.width = appCanvas.width-40; 
                pdf.height = appCanvas.height-60; 
                pdf.load(request);
                pdf.addEventListener(LocationChangeEvent.LOCATION_CHANGE, function(evt:LocationChangeEvent):void
                {
                    if(evt.location.toLocaleLowerCase().substring(evt.location.length-4) == "html" )
                    {
                        var str:String = escapeMultiByte(evt.location.slice(8));
                        str=unescape(evt.location);

                        var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

                        var mp:File = new File("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
                        nativeProcessStartupInfo.executable = mp;

                        var args:Vector.<String> = new Vector.<String>();
                        args.push(evt.location);

                        nativeProcessStartupInfo.arguments = args;
                        var process:NativeProcess = new NativeProcess();

                        process.start(nativeProcessStartupInfo);    

                        pdf.historyBack();
                    }
                });
                myWin.addChild(pdf); // Add the HTMLLoader to my HTML component
            } else { 
                Alert.show("PDF cannot be displayed. Error code:" + HTMLLoader.pdfCapability); 
            } 
        }
4

1 回答 1

1

它通过在加载 HTMLLoader 时重新更改 appCanvas 的宽度来解决。我在函数的末尾添加了这段代码。

               setTimeout(function():void{
                appCanvas.width +=1;
                appCanvas.height +=1;
                appCanvas.width -=1;
                appCanvas.height -=1;
            },30);
于 2013-05-07T08:44:14.427 回答