6 Replies Latest reply on Apr 19, 2010 1:55 PM by Shunshifuw

    How to set window chrome

    Shunshifuw

      Hello All,

       

      Forgive me, I'm totally new to adobe air AND javascript. I'm a total hack but learning.

       

      I'm trying to open a new window but make that window transparent. The window will be used as a timer to eventually pop up a third window.

       

      Originally when creating the project I had set window chrome to normal. I later figured out that it needed to be set to none. I'm using aptana and couldn't find any way to change the setting. Editing the xml file didn't seem to work.

       

      So I created a new project with the proper chrome setting and then pulled all my files into it. that seems to work.

       

      However I'm still getting this error when trying to open a new native window

      Error: Illegal window settings.  Transparent windows are only supported when systemChrome is set to "none"

       

      I've played with the code a lot but can't seem to get it right. Can't get it to set chrome to none for the window being created. Here's the code for the initial page of the project. Hope someone can help

       

      Thank You

       

      Phil

                                                                          

      Break Pal - Fitness at Your Desk

             
                                 http://www.adobe.com/go/airhtmlsecurityfaq.                clearwindow                  
        • 1. Re: How to set window chrome
          Shunshifuw Level 1

          oops, I guess I don't know how to insert code either.

           

          <html>
              <head>
                  <title>Break Pal - Fitness at Your Desk</title>
                  <link href="sample.css" rel="stylesheet" type="text/css"/>
                  <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
                  <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
                  <script type="text/javascript">
                      // AIR-related functions created by the developer
                      // reads the content of a local text file
                                
                      function openInBrowser(url) {
                          air.navigateToURL( new air.URLRequest(url));
                      }
          function doLoad10sec()
          {
              document.getElementById( 'window10' ).addEventListener( 'click', doWindow10sec );                   
          }

           

          function doWindow10sec()
          {
              var init = new air.NativeWindowInitOptions();   
              var bounds = null;
              var win = null;
              var login = air.File.applicationDirectory.resolvePath( '10sec_timer.html' );  

           

              bounds = new air.Rectangle( ( air.Capabilities.screenResolutionX - 325 ) / 2, ( air.Capabilities.screenResolutionY - 145 ) / 2, 325, 145 );

           

              init.minimizable = false;
              init.maximizable = false;
              init.resizable = false;
              init.transparent = true;
             
             
              win = air.HTMLLoader.createRootWindow( true, init, false, bounds );
              win.load( new air.URLRequest( login.url ) );
          }

           

          function doLoad20sec()
          {
              document.getElementById( 'window20' ).addEventListener( 'click', doWindow20sec );                   
          }

           

          function doWindow20sec()
          {
              var init = new air.NativeWindowInitOptions();   
              var bounds = null;
              var win = null;
              var login = air.File.applicationDirectory.resolvePath( '20sec_timer.html' );  

           

              bounds = new air.Rectangle( ( air.Capabilities.screenResolutionX - 325 ) / 2, ( air.Capabilities.screenResolutionY - 145 ) / 2, 325, 145 );

           

              init.minimizable = false;
              init.maximizable = false;
              init.resizable = false;
             
              win = air.HTMLLoader.createRootWindow( true, init, false, bounds );
              win.load( new air.URLRequest( login.url ) );
          }
                 
                     
                     
                  </script>
              </head>

           

              <body onLoad="doLoad10sec(); doLoad20sec();">
                  <h3>Break Pal - Fitness at Your Desk</h3>
                 
          <input id="window10" type="button" value="window1" />
          <input id="window20" type="button" value="window2" />

           

                      <a href="#" onclick="openInBrowser('http://www.adobe.com/go/airhtmlsecurityfaq');">http://www.adobe.com/go/airhtmlsecurityfaq</a>.
                      <a href="#" onclick="clearwindow();">clearwindow</a>  

           


                 
              </body>
          </html>

          • 2. Re: How to set window chrome
            Shunshifuw Level 1

            By the way what I'm trying to do is rebuild the widget from here

            Break Pal - Workplace Wellness

            it was built on a yahoo widget which is just not doing the job.

            Any coders here want a membership just let me know and I'll set you up. Keep you in shape while your coding

             

            Phil

            • 3. Re: How to set window chrome
              Joe ... Ward Level 4

              In the NativeWindowInitOptions object you use to create the transparent windows, set the systemChrome property to air.NativeWindowSystemChrome.NONE.

              • 4. Re: How to set window chrome
                Shunshifuw Level 1

                That's what I attempted to do. Kept getting an error saying can't find variable none

                I must be doing it wrong.

                 

                Phil

                • 5. Re: How to set window chrome
                  Joe ... Ward Level 4

                  Try either window.runtime.flash.display.NativeWindowSystemChrome.NONE or simply "none".

                  1 person found this helpful
                  • 6. Re: How to set window chrome
                    Shunshifuw Level 1

                    Thank You. It's working now.

                    Finally starting to get familiar with air