I have an AIR application written in html/javascript and I want to use the Actionscript print functions but I have no experience in Actionscript for AIR.
Where do I put the Actionscript code ? Does it go into an mxml file or does it need to be compiled into a Flash application. Where do I put it and how do I include it into the html document ? Finally, how do I call the AS function from Javascript ?
=====update=====
I know I have to compile either an .mxml or .as file into .swf using mxmlc and I have the following in my .as file:
package {
import mx.controls.Alert;
public class HelloWorld {
public function HelloWorld():void {
trace("Hello, world!");
}
}
}
Or alternately, this in a .mxml file:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function HelloWorld():void {
Alert.show("hello world!");
trace("Hello, world!");
}
]]>
</mx:Script>
</mx:Application>
This compiles OK, but when I include it in a html file with:
<script src="actionscript.swf" type="application/x-shockwave-flash"></script>
I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.managers::FocusManager/activate() at mx.managers::SystemManager/activateForm() at mx.managers::SystemManager/activate() at mx.core::Application/initManagers() at mx.core::Application/initialize() at actionscript/initialize() at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded() at mx.managers::SystemManager/initializeTopLevelWindow() at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler() at mx.managers::SystemManager/docFrameListener()
Any ideas what that means ?