How open pdf in Air for Android/Black berry

╄→гoц情女王★ 提交于 2020-01-01 17:09:12

问题


I want to open pdf in Air for Android/Black berry.

How i do that?

I use AIR 2.6 and IDE is Flash Builder 4.5.


回答1:


StageWebView.

http://help.adobe.com/en_US/as3/dev/WS901d38e593cd1bac3ef1d28412ac57b094b-8000.html

Example copied from the link above:

package  { 
    import flash.display.MovieClip; 
    import flash.media.StageWebView; 
    import flash.geom.Rectangle; 

    public class StageWebViewExample extends MovieClip{ 

        var webView:StageWebView = new StageWebView(); 

        public function StageWebViewExample() { 
            webView.stage = this.stage; 
            webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ); 
            webView.loadURL( "http://www.adobe.com" ); 
        } 
    } 
}



回答2:


The StageWebView is the solution #1.

However, this won't work on Android 3 tablets. For activating any plugin (e.g., Flash or PDF) in the StageWebView you need to explictely enable hardware acceleration in the description file. This part would be easy, but Flash CS 5.5 would not package your -app.xml since it checks against the Froyo lib and not the Honeycomb lib. Since the hardwareaccelartion is a feature of Honeycomb, it is unknown for CS5.5.

Here is an immediate need for updating your products Adobe!!!!

So do it with the StageWebView but keep your tablet friends in mind. Give them a message at least.




回答3:


On android if adobe reader is installed this seems to work:

var oFile:File = new File ( File.documentsDirectory.resolvePath ( "filepath/test.pdf" ).nativePath );
var oUrl:URLRequest = new URLRequest ( "file://" +oFile.nativePath );
navigateToURL ( oUrl );

The important and poorly documented part is prepending "file://" to the path.



来源:https://stackoverflow.com/questions/6184927/how-open-pdf-in-air-for-android-black-berry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!