4 Replies Latest reply on Mar 2, 2011 7:09 PM by fulvio80

    Problem with HTMLLoader

    fulvio80

      I'm loading an external swf with HTMLLoader to open it in a new window from an Air application. But it generates a blank space of 28 pixels above the swf loaded in the new window.

       

      How could I remove that blank space?

        • 1. Re: Problem with HTMLLoader
          injpix Level 3

          Can you isolate the issue?  You mentioned that you are using, "...HTMLLoader to open it in a new window from an Air application."  I assume 'new window' is a spark.component.Window.  Have you tried to open it in the WindowApplication instance of your application instead of Window?  If so, is there a padding above the .swf loaded?

          • 2. Re: Problem with HTMLLoader
            fulvio80 Level 1

            I have an air application who runs a local swf. This swf have to load and open in a new, and indepedent, window other swf located in a server.

            So... I load this swf with htmlloader and create a new window. Here is the sample code.

             

            public function execute(event:CairngormEvent):void

            {

            var evt:DownloadEvent = event as DownloadEvent;

             

            var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();

            windowOptions.minimizable = false;

            windowOptions.maximizable = false;

            windowOptions.resizable = false;

            windowOptions.type = NativeWindowType.NORMAL;

            windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;

            var bounds:Rectangle = new Rectangle(100, 100, 800, 550);

            html= HTMLLoader.createRootWindow(true, windowOptions, true, bounds);

            html.addEventListener(Event.COMPLETE, onComplete);

            html.load(new URLRequest(evt.url));

            }

             

             

            • 3. Re: Problem with HTMLLoader
              injpix Level 3

              I am using the application code below to load a .swf file from online and I don't see any padding above the .swf file as you mentioned.  Perhaps its the .swf file you are loading?  Are you loading a webpage that contains a .swf file?  Attached are screenshots of the application running.

               

              <?xml version="1.0" encoding="utf-8"?>
              <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                          xmlns:s="library://ns.adobe.com/flex/spark" 
                                          xmlns:mx="library://ns.adobe.com/flex/mx" applicationComplete="execute()">
                   <fx:Script>
                        <![CDATA[
                             
                             private var html:HTMLLoader;
                             
                             public function execute():void
                             {
                                  var url:String = "http://cdn.crimereports.com/CrimeReports-20110302160119.swf";
                                  
                                  var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
                                  windowOptions.minimizable = false;
                                  windowOptions.maximizable = false;
                                  windowOptions.resizable = false;
                                  windowOptions.type = NativeWindowType.NORMAL;
                                  windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
                                  
                                  var bounds:Rectangle = new Rectangle(100, 100, 800, 550);
                                  html= HTMLLoader.createRootWindow(true, windowOptions, true, bounds);
                                  html.addEventListener(Event.COMPLETE, onComplete);
                                  
                                  html.load(new URLRequest(url));
                             }
                             
                             private function onComplete(event:Event):void
                             {
                                  event;
                             }
                        ]]>
                   </fx:Script>
              </s:WindowedApplication>
              

              Screen shot 2011-03-02 at 3.57.49 PM.png

              • 4. Re: Problem with HTMLLoader
                fulvio80 Level 1

                Yes that was the problem... I had an invisible rectangle in an asset.

                 

                Thank you...

                 

                Do you know how could I set an icon and a title in the new window?