Importing a program from ActionScript 3 to Adobe AIR
I have made an application that is coded only in ActionScript 3.0, and uses HTML and JavaScript for the display.
I would like to have the same result, but using Adobe AIR. I do not know Adobe AIR at all, so I was wondering if you could direct to some good tutorials that will teach me ho开发者_如何学编程w I can move my .html/.js/.as files to Adobe AIR please. I am using Adobe Flash Builder 4.
Thank you very much,
Rudy
Are you using HTML and JavaScript for anything other than embedding the SWF? If not, you can create a Flex project from Flash Builder (at least that was the way in Flex Builder 3 - I don't know if they've changed it) and mark output format as AIR to start with. The easiest way would be to add the main Sprite
of your AS project as a child to the rawChildren
of the WindowedApplication
class of the AIR from the creationComplete
event handler.
It is hard to say more without knowing what type of project you're talking about.
You could still do this, but you would have to embed your own browser. Look at HTMLLoader:
At the very simplest, your air app would create an html display, where you would then embed your swf into an html page. (almost exactly like what you're doing now). However, AIR's webkit seems fairly old, and they didn't import everything, so some css stuff like corner-radius, etc, will not display as you would in any other browser.
However, this will only get you so far, as you won't have AIR capabilities yet. You would have to extend HTMLHost to create an API for the javascript container to access desktop'y capabilities, when you when then again have to use ExternalInterface again. This is probably where things will get a lot more tricky.
精彩评论