5 Replies Latest reply on Oct 14, 2014 12:08 AM by poortip87

    Load webpage in Flex extension for InDesign

    poortip87 Level 1

      Hi All,

       

      I am implementing an extension for InDesign CS6 and CC using Flash Builder 4.6, Ext Builder 2.1.

      The panel reads a text file which contains the url of a webpage and renders it in an HTML control.. It is working with most urls..

       

      But sometimes it stops loading the page midway. I get the urls from my client.

       

      Here is the code I am using,

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="absolute"
        creationComplete="livepreview_creationCompleteHandler(event)">
      
      <mx:Script>
      protected function livepreview_creationCompleteHandler(event:FlexEvent):void
      {
        var livePreviewFile:File = File.desktopDirectory.resolvePath("LivePreviewUrl.txt");
        if(livePreviewFile.exists)
        {
             var fileStream:FileStream = new FileStream();
             fileStream.open(livePreviewFile, FileMode.READ);
             var livePreviewUrl:String = fileStream.readUTFBytes(fileStream.bytesAvailable);
             if(livePreviewUrl != "")
                  livepreview.location = livePreviewUrl;
        }
        else
        {
        //TODO
        //Get some error error html url from server and use its value for location
        //livepreview.location = some error/hard coded url from server.;
        }
      }
      </mx:Script>
      
      <mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
        <mx:HTML id="livepreview" x="0" y="0" width="100%" height="100%"/>
      </mx:VBox>
      
      

       

      Is it possibe that background scripts executing in the webpage might be getting blocked by Flex causing the improper load?

       

      Any way to overcome this?