1 Reply Latest reply on Jun 9, 2010 10:52 PM by Joe ... Ward

    TypeError: Error #2007: Parameter Type Must Be Non-null

    samarudge

      Hey,

      So I'm kind-of new to AIR, I'm using AIR AJAX/HTML and wanted to create a function that made sure the window has a minimum size. I wrote this function

      var check_size = function() {
           if ( window.nativeWindow.width < 690 ) {
                window.nativeWindow.width = 690;
           }
           if ( window.nativeWindow.height < 400 ) {
                window.nativeWindow.height = 400;
           }
      }
      window.nativeWindow.addEventListener(air.NativeWindowBoundsEvent.resizing, check_size);
      

       

      However when I run this I get the error

      TypeError: Error #2007: Parameter Type Must Be Non-null
      

       

      For refference this is the complete HTML/JS for the application so far (There isn't much of it yet)

       

      main_app.html (The initial content of the app)

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>Application</title>
      <script src="AIRAliases.js"></script>
      <script type="application/javascript" language="javascript" src="media/js/main.js"></script>
      <link type="text/css" rel="stylesheet" href="media/css/main.css" />
      </head>
      
      <body onload="init();">
      </body>
      </html>
      

      And the contents of main.js

      //Some initial settings
      //Useful vars
      
      //Get the usable size of the display
      var  stat_screen_width = screen.width;
      var stat_screen_height = screen.height;
      
      //Resize and position the window top right
      var stat_screen_x = stat_screen_width-690;
      window.nativeWindow.x = stat_screen_x;
      window.nativeWindow.y = 0;
      window.nativeWindow.width = 690;
      window.nativeWindow.height = stat_screen_height;
      
      //We don't want the window to be thinner than 690px or shorter than 400px so this function sorts that
      var check_size = function() {
           alert('OK');
           if ( window.nativeWindow.width < 690 ) {
                window.nativeWindow.width = 690;
           }
           if ( window.nativeWindow.height < 400 ) {
                window.nativeWindow.height = 400;
           }
      }
      window.nativeWindow.addEventListener(air.NativeWindowBoundsEvent.resizing, check_size);
      
      function init() {//Startup script
      /*
      
      */
      }
      

      Thanx,

      Sam Rudge