Michael,
I had problems getting the ActionScript project code into the AIR
application.
The original Document Class from OriginalProgram.AS would not run
because it was no longer automatically on the display list and so its
stage variable was null.
I emptied the code from the constructor into a new function called main,
added an instance to the stage, see below, and completed the
construction via main().
It could then proceed since stage was no longer null.
My background colour has changed and the aligment isn't working but it
looks very promising.
Thanks again.
John
?xml version=1.0 encoding=utf-8?
mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute creationComplete=start();
mx:Script
![CDATA[
private var prog:OriginalProgram;
public function start():void {
prog=new OriginalProgram; // An instance of the
original Document Class
nativeWindow.stage.addChild(prog); // The constructor needs the
prog.stage variable set, and
prog.main(); // then this can
now run all the original constructor code.
}
]]
/mx:Script
mx:UIComponent id=container /
/mx:WindowedApplication
Michael wrote:
John,
Though your code is in ActionScript, you should just be able to use the MXML
WindowedApplication tag just at the very top-level, and initialize your main
ActionScript UI within an mx:Script tag.
Something like:
mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml;
applicationComplete=init();
mx:Script
![CDATA[
private function init():void
{
// Fire up all your AS stuff here
}
]]
/mx:Script
/mx:WindowedApplication
Finally, I left out a step (4) in my previous message. Steps 1-3 are
sufficient to run your AIR app in the debugger, but to distribute your AIR
application you typically need to generate and sign a .air file. Flex
Builder can do that; from the raw SDK, you should check out the adt tool.
Hope this helps,
Michael Portuesi
--- In flexcoders@yahoogroups.com, John McCormack j...@... wrote:
Thanks Michael,
I will give this a try.
Currently, within FB3 I can create an AIR project and it does these
things for me but the output is structured similarly to a Flex project
but my projects are ActionScript projects built within FB3 and so the
conversion isn't quite the same.
Perhaps I should be looking to convert from AcitionScript to Flex as an
intermediate step: by minimizing the mxml and calling my main Document
Class from the main mxml class and then modify that for AIR.
It's annoying because from within Flash Prof. I can publish as AIR, but
that's a conversion step backwards.
John
Michael wrote:
John,
You can convert your Flex project to an AIR application pretty easily.
There's three basic steps involved:
1) Your application should be declared as inheriting from
WindowedApplication, rather than Application in your main myapp.mxml file.
mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
!-- declaration of your app top-level fixtures goes here --
/mx:WindowedApplication
2) Create an AIR app descriptor file. Here's an example. Name it
myapp-app.xml and place in the same folder as your main myapp.mxml file.
?xml version=1.0 encoding=UTF-8?
application xmlns=http://ns.adobe.com/air/application/1.5.1;
idcom.myapp.tester/id
version0.1/version
filenametester/filename
nameFlexUnit Test Runner/name
initialWindow
contenttester.swf/content
visibletrue/visible
systemChromestandard/systemChrome
transparentfalse/transparent
width1024/width
height768/height
/initialWindow
/application
There is detailed documentation on the AIR app descriptor format on the
Adobe site:
http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html
3) Use the AIR MXML compiler (amxmlc rather than mxmlc) in your build
scripts. If you're using Flex Builder, you can add an AIR Project Builder
to your in the Project Properties Builders pane.
That should be enough to get you started. Good luck.
Michael Portuesi
--- In flexcoders@yahoogroups.com, John McCormack john@ wrote:
Is there any easy way to publish a Flex ActionScript Project as an AIR
file.
This project, by its nature, has no mxml tags.
John
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links