'How to replace HTMLLoader to display PDF inside air application

With the latest version of adobe air the component HTMLLoader has been removing. In my case, I used it to display pdf files inside my air application.

if ( HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK )
{
if ( dgHisto.selectedIndex != -1 )
{
var urlCourTXT:String=dgHisto.selectedItem.courl;
container.removeAllChildren();
urlCourTXTServ=new urlManager().urlCourriers() + urlCourTXT;//+ "#statusbar=0";

        pdf.height=container.height-10;
        pdf.width=container.width-10;
        
        
        var request:URLRequest=new URLRequest( urlCourTXTServ );
       
        try
        {
            pdf.load( request );
        }
        catch (error:ArgumentError)
        {
            Alert.show( "An ArgumentError has occurred : error:ArgumentError" , "Attention", Alert.OK, this);
            
        }
        catch (error:SecurityError)
        {
            Alert.show( " error:SecurityError" , "Alert", Alert.OK, this);
        }
          
        var ui:UIComponent=new UIComponent();
        ui.addChild( pdf );
        container.addChild( ui );
    }
    
}

In this sample, container is a mx:VBox with drag and drop event. So I try to do the same with StageWebView but it doesn't work !

package fr.mycompagny.component.pdf
{
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.geom.Rectangle;
    import flash.media.StageWebView;
    
    import spark.components.BorderContainer;

    public class WebView extends BorderContainer
    {
        private var _webView : StageWebView;
        public function WebView()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            
            _webView.addEventListener(Event.ACTIVATE,onAddedToStage);
        }
        
        
        private function onAddedToStage(event : Event) : void
        {
            removeEventListener(Event.ACTIVATE,onAddedToStage);
            
            createWebView();
            
            _webView.loadURL("http://www.sitename/pdfName.pdf");
        }
        
        private function createWebView() : void
        {
            _webView          = new StageWebView();
            _webView.stage    = stage;
            _webView.viewPort = new Rectangle(0,
                0,
                stage.stageWidth,
                stage.stageHeight);
        }
        
    }
}

Could you help me to find a solution. Thanks for helping. Best regards



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source