Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1
Testing the Application | 37

function init( )
{
runtime2.trace("init function called");
}
</script>

</head>
<body onload="init( )">
<div align="center">Hello World</div>
</body>
</html>

All we did was change theinitfunction to try and access a
property namedruntime2 that does not exist:


runtime2.trace("init function called");

Save the file, and run the application from ADL:


adl AIRHelloWorld.xml

The application should launch, and you should see the fol-
lowing error output from the command line that you
launched the application from:


ReferenceError: Can't find variable: runtime2
init at app-resource:/AIRHelloWorld.html : 8
init at app-resource:/AIRHelloWorld.html : 8
onload at app-resource:/AIRHelloWorld.html : 13

This output provides the error, which in this case is that the
variable namedruntime2cannot be found, as well as the line
number that the error occurred on, and a stack trace of the
execution call.


This information can be used to track down any errors
within your application.


There are also times where the application may not be func-
tioning correctly, but is not throwing any errors. In cases like
this, it is useful to be able to capture information about the
state of the application at runtime, in order to track down
any issues.

Free download pdf