Hey,
So I'm writing an application in Adobe Air (AJAX) and I've come upon a little problem.
I've created a function to set a minimum size for the window
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