Importing a program from ActionScript 3 to Adobe AIR - actionscript-3

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 how 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.

Related

How to "convert" a simple flash project to HTML5 using OpenFL

I have to "convert" some flash projects to HTML5/JS but I don't really know how I can do it :(
This flash projects are little "activities" like this one :
https://www.brainpop.com/artsandmusic/artconcepts/cameras/activity/#=standard
I did some research about it, but i'm a bit lost...
I found other people asking the same question and a lot of responses are to use Haxe/OpenFL and as3hx (https://github.com/HaxeFoundation/as3hx) but I don't really understand how to proceed...
Is it possible to load a .swf file with openfl-swf to create a similar .html file ?
Should I convert AS3 to Haxe3 with as3hx ?
Is there a simple way to just get a graphic render of this activities without any interactivity so I can add manually input text field ?
I never used ActionScript or Haxe before.
If someone has any suggestions i'll be glad to hear it :)
I hope my explanations are clear, english is not my first language, so excuse me for any mistake.
Cheers !
as3hx will convert only as3 code to haxe openfl and may well need hand tweaking. To make the code more flexible try to avoid extending Sprite then potentially it will be easier to use your activity logic in more webgl accelerated haxe solutions like Kha and Luxe.
You probably need clean seperation of the code and the onscreen layout.
To run a fla swf that is mostly graphics in openfl you need to use the haxelib https://github.com/openfl/swf, it can be quite fiddly getting to different children or frames and the gradients are not perfect, just remember when using it that it's not the same as accessing a child normally your using a structure that is a bit different to do that.
Alternatively you may find flump useful it can be used with openflump.
https://github.com/SavedByZero/openflump exports from flash IDE.
It converts lots of your graphics to png sequences in nested structures, it would probably be worth rebuilding textfields yourself.
Openfl js can be slow I suggest you do some tests before committing to a solution, since Kha or Luxe may provide you a more shader modern approach to graphics than a flash emulation api solution, but then all you assets largely need to be images.
I doubt if there is any ideal way but getting your logic in Haxe is really good idea because then you can do c++, c#, js etc.. The first step if you choose openfl is to perhaps to try just porting parts of your code to haxe and then use them as a swc in your current projects this will allow you to gradually check your conversion and fix an issues easily within a haxe flash approach prior to trying to do the same in html haxe. You may find the swf library is not ideal for html5 and that png's are the way to go, Animate now provides export png sequence which I have used in starling as3. Another approach to consider is the away3d plugin for Animate it can convert flash timeline into typescript away3d (2D ) that you can control with javascript code ( even haxe you may have got from as3hx if you remove some of the flash specific haxe and adjust it to work with the away3d 2d but I guess it could be very complex ).

Adobe Air integrate Flex Components

I'm currently developing an Adobe Air application, using Adobe Flash CC 2005, Flash Builder 4.7, and ActionScript 3.
I notice that the UI Components like the List Component don't scroll up or down with finger on mobile devices.
If I'm understanding right, the Flex Framework has components like a List that support mobile.
Is it possible to integrate Flex Components to the existing Adobe Air project? If so, how?
Use feathers instead.. it's similar to flex.
http://feathersui.com/
I don't think so. You can wrap Flash Classes for use in Flex, but Flex components depend on the Flex Framework, which is contradictory with the timeline and the way Flash gets used in Flash. I believe that Air will generate those events when you publish your project for Air, so you should be able to add the functionality by listening for the events yourself and updating the scroll position. Good luck--the Flash component code isn't the easiest in the world to work with. You might be better off writing your own implementation so you know what's in it.
To give a little more insights on top of the answers already given. Yes it's possible but it's probably not worth the trouble because of the hacky way this must be done and the potential troubles this will bring. As said to one answer you should probably create your own specific components or try to find some in a custom library like MadComponents or others.
2 possible ways:
You can include all relevant Flex .swc in your project and then try for each component needed to instantiate yourself those components and follow strictly the Flex object instantiation workflow. This can be easy (Button) to very difficult depending on the component.
Create the needed component in a Flex project. Export the resulting .swf. Load that .swf in your AIR project (can be difficult in Ios). Access objects within the loaded .swf and create clones or use those objects directly in your app. This is a hack and results can be deceiving. The loading app will have to listen to the relevant Flex Event in order to determine if the components are ready to be used.
In a nutshell: it's possible to use Flex for creating Adobe AIR applications. Here are few articles from the official Adobe website:
Creating your first desktop AIR application with the Flex SDK
Creating your first desktop Flex AIR application in Flash Builder
Also, please, pay attention, that Flex-based applications require a different version of Flex SDK, than regular AS3-based applications.
http://www.adobe.com/devnet/air/air-sdk-download.html - here at the bottom you may find links to the AIR SDK for the Flex-based applications and text:
Note: Flex users will need to download the original AIR SDK without
the new compiler.

Is there any way to read a pdf using AS3? (Air)

I want to be able to read at least some of the info a pdf has, this is in mobile, using an installed app built with Air.
Are there any libraries or methods to do this?.
Thanks.
Easiest way to do it is through StageWebView if you are running iOS. On Android, I haven't really found a good way to do it. There are no good libraries for it. Almost every PDF-related AS3 library is focused on writing PDFs, not displaying them. I've found a few in the past that can display them, but the end result is terrible and slow.

FlashDevelop ? Do i still need Flash CS

I am fairly new to Flash and AS3.
My questions is do I actually still need to use Flash CS6 to setup the stage and library files.
Or can it all be done from FlashDevelop ?
Thanks
Flash CS6 is an application similar to Photoshop, you generally use it for creating/structuring/positioning graphical resources and then makes it possible to animate these (from keyframe to keyframe) and then access the graphical content from code.
So, the answer is no, you can create a SWF file without Flash, you can embed content to use in AS3-code without flash and you can use flex-components and position them without flash.
But creating any bigger project like that would be pretty unnecessary since you just as well could use some other language or tools for doing that kind of stuff. Tools and languages that were designed to do this specific thing.
Few months ago I switched completely to FD and since today I successfully built everything only in FD. The reason was that I had huge project to publish, and I couldn't compile it in Flash because of memory shortage for JVM compiler. With FD that was not a problem.
So in short, no, you don't need flash any more.
Though maybe there can be some things that you can create quicker and easier way in Flash than in FD (for example: some timeline animation and then publish to SWC to use with FD).
I still have Flash installed, just in case for quick animation jobs.
You need it if you want to create graphic objects to use them later in your code. The alternative is to create everything by code
It depends. If you need to use vector graphics, drawn in Flash, then the easiest way to incorporate them in your project is to use the IDE-based project (http://www.flashdevelop.org/wikidocs/index.php?title=Projects#AS3_Flash_IDE_Project). This isn't the only way, but it's easier than packaging them up and using libraries. In this case you are effectively using FD just as an external AS editor (and it's worth doing it just for this, since it is a much better editor than the one built in to Flash Pro.
If, on the other hand, you are working with objects drawn in code, with text, or with external bitmaps, then no, there's no real need to use CS* at all.
The advantage to OOP is having an environment like Flash for layout. It's been pretty crucial for me as a designer and when implemented correctly with a proper class structure, becomes extremely powerful. It really depends on what you are using as3 for. I find the Flash architecture to be most advantageous in the context of interface design, but for things like games or "static" interactives, sometimes its much more efficient to do everything in code and compile outside of Flash.

Embedding .exe in html

I need help to embed a game into HTML, If I did replicate the game in html, it`s complicated so is there any code to do it?
PS: It has to be an element in the site not opened in a new window
You cant embed an exe in html. You can either rewrite the game in a web-friendly language such as javascript, flash, or java, or you can just make it be a downloaded game. If exes were allowed to run from webpages, viruses would be even more prevalent than they are now.
Extremely wild guess here, but if you made the game with Game Maker, there is GameMaker:HTML5 available, which allows you to take the same code as you wrote for the Windows EXE and export it to valid HTML5/JavaScript.
Aside from that, there is no way to embed an EXE into a webpage.