0 Replies Latest reply on Dec 1, 2011 1:05 AM by Niall O'Donovan

    PDF Component

    Niall O'Donovan Level 7



      I have a component that is intended appear in one state and display various PDFs. I have it working when it is called the first time, however when it is called subsequently it does not load the PDF.


      I have been using the Tour de Flex approach of using a mx:HTML to show the PDF, but changed to adding elements to a spark container:


      private var pdfHTMLLoader:HTMLLoader = new HTMLLoader();

      private var pdfUIC:UIComponent;


                                    private function loadPDF():void {

        // Check to see if Adobe Reader 8.1 or higher is installed

        // Possible values:

        //         HTMLPDFCapability.STATUS_OK




                                              if(HTMLLoader.pdfCapability == HTMLPDFCapability.STATUS_OK) 


        // Use FlexGlobals variable for PDF name

                                                        var pdfRequest:URLRequest = new URLRequest(FlexGlobals.topLevelApplication.currentPDF);


                                                        pdfHTMLLoader = new HTMLLoader();

                                                        pdfHTMLLoader.width = pdfWin.width;

                                                        pdfHTMLLoader.height = pdfWin.height;



                                                        pdfUIC = new UIComponent();


                                                        pdfUIC.name = "PDFView";


                                                        pdfWin.addElement(pdfUIC); // Add the element to the pdfWin spark container


                                              } else {

                                                        Alert.show("PDF cannot be displayed. Error code:" + HTMLLoader.pdfCapability);




        // Called if window is resized

                                    private function reloadPDF():void {

                                              pdfHTMLLoader.width = pdfWin.width;

                                              pdfHTMLLoader.height = pdfWin.height;




                                    protected function backButton_clickHandler(event:MouseEvent):void





                                              var eventObject:Event = new Event("hidePDF");





      I think that the problem may be in either removing the elements or in how I am adding the HTMLLoader to the UI Component and then adding the element to the spark container.