How can I convert a Haxe SWF to a compiled native app using AIR?
Is there a way to override the Flash default .SWF export when you use a Haxe Command Line to export a SWF that can be packaged up into an Adobe Air file?
I'm having trouble finding information on how to compile a Haxe .SWF export via command line into Adobe Air. Ive tried deleting the default swf and renaming the Haxe .swf export, but Adobe still rewrites it when it packages everything up.
E.G: "haxe -swf main-flash.swf -main Main -swf-version 15 -swf-header 960:640:60:f68712"
I'm using Mac OS X with Flash CC and Atom to write my game with Starling-HAXE. I want to target desktop (PC/MAC/Linux).
Thanks!
The OpenFL tools used to support Adobe AIR on the desktop, if you look at this older helper class, you may find hints on how you might go from a Haxe-generated SWF file to a final AIR application:
https://github.com/openfl/lime-tools/blob/master/helpers/AIRHelper.hx
Looking at it again, I believe you call ADT with the proper signing parameters. You probably need an application.xml file as well, here is one:
https://github.com/openfl/openfl/blob/master/templates/flash/templates/air/application.xml
You would need to replace variables such as "::APP_PACKAGE::" with com.yourcompany.yourproject, and other sensible values.
If someone would like to look at integrating AIR support into the Lime tools again, I'm open to the idea. The problem I was concerned about was long-term maintenance
I have some batch files that will do this (although will most likely need to be reworked on your behalf). I'm not at my computer right now, but will post them over the weekend. On a side note it would be great to have this type of functionality baked into flashdevelop.
Related
I'm building a program in Actionscript 3 and would like to convert the .SWF file to an EXE without using Flash Pro CS5. I found http://swf-to-exe.com/ and it works well, but I'm wondering if there is another way to do this. In the long run we'll need Mac executables, too, and if I can avoid putting it all in Flash I'd like to do that.
The most simple way is to create projector file with Flash Player, but you have to do it for every OS. It embed the hole Flash Player into the resulting *.exe file.
Steps for exe:
Download 11.2.202.235 Flash Player vesrion
Open flashplayer_11_sa_32bit.exe
Open swf file with this FP or drag and drop swf on player
File->create projector
As I know the last FP version, where projector feature works is 11.2.202.235, for Mac it can be another version. There is the description of this #Bug 3363321 in Adobe bugbase
Adobe AIR is the standard solution for packaging SWF applications natively. The AIR SDK is freely available and includes the mxmlc compiler which will compile .as to .swf, and the adt packager will package your SWF and assets for Android, iOS, Windows, and OSX.
It looks like you want to bundle natively for Windows to produce an executable. Do you have a programming environment? You may want to check out the free Flash Develop IDE.
Ah, so you are using Flash Develop... Good, onward.
In Flash Develop, I created an "AIR AS3 Projector" type project named DesktopTest. I then modified the Packager.bat file according to the article I posted above. Change the OUTPUT and call adt lines and leave the other lines of the file in-tact:
set OUTPUT=-target bundle %AIR_NAME%
And:
call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
You then need to run CreateCertificate.bat once (right-click, execute). After that, compile your project and run PackageApp.bat. For my project named DesktopTest, this results in a DesktopTest sub directory that is my compiled app, with a DesktopTest.exe in it.
SWF converted to EXE is most likely a projector file, it still needs a Flash Player. Depending on build it could have the FP compiled into itself and thus don't need a Flash Player externally, but it comes with a cost or larger file-size.
Now with AIR, you have a choice to make a Flash project that will run natively trough the AIR virtual machine (that can be included for compilation time, so the user doesn't need to install it separately). But still, there WILL be a SWF file in that EXE or APP package.
Good thing about AIR - it works universally on both Win and Mac. Mobile platforms are also supported.
You can build AIR projects without buying Flash Professional, CC or Flash Builder. Just download the SDK and compile your code.
If you're using Windows, you can do it very easily with FlashDevelop - it's a powerful IDE that works out of the box. And it's free too!
http://www.flashdevelop.org
Get MDM Zinc. It has everything you need for crossplatform flash development.
I have created an app in Flash CS5.5 and would like to put admobs advertisements in it.
I am having problems figuring out where to put the .jar file that comes with admobs.
All the tutorials say put it in "build path", but there is no build path option in Flash Pro CS5.5
Flash Develop and I are not on good terms right now, and I am currently using Sublime Text 2 for coding all of the as3 and xml.
Can someone give some advice on how to get this working with the programs I am using?
JAR files are for Java applications and will not work with Actionscript.
Depending on the platform that you are targeting you will have to choose an alternative way to deploy AdMobs. For instance, if you are trying to use AdMobs on an AIR app targeting Android or iOS you can use an ANE (AIR Native Extension) such as this one.
I already made a game with flash, and I want to provide an easy download for people that would rather play offline. Thing is, i use a folder whole structure to dynamically load content per level. Folder structure looks like this, not that it matters that much:
Game folder
animations
anim1.swf
anim2.swf
sounds
music1.mp3
soundeffect1.mp3
levels
level1.lev
level2.lev
myGame.swf
How should I go to distribute this? Should I just resort to make a zip file for the flash game and assume people know how to extract and open the swf? Is there any other way to port easily as an executable? Perhaps Adobe Air (not sure if this works though)?
Thanks, and please help!
Distributing a zip file is the only option if you really want that structure to prevail. Else,
Embed all the resources in the main (myGame) swf & distribute it.
Provide a html page for people who do not have standalone flash player installed.
Embedding as a single file allows the browser to cache the single swf & allow the player to keep playing offline until cache is cleared. So user might not even need an explicit download.
If you are using Flash Builder it is fairly straightforward to compile the application into a self-installing AIR executable (or DMG on a Mac). It is possible to include the AIR runtime which would avoid potential problems of the user not having the correct flash player for example.
An alternative to AIR would be to create a projector executable from inside the standalone Flash Player or from the Flash authoring environment.
Another option to using a zip file would be to use a free installer creator such as InnoSetup or Nullsoft on Windows, or Packager on Mac. Linux users are generally more tech savvy and so a tar would probably be well understood.
Adobe AIR works wonderfully! I use it for my own project, and your project should transition over to it with little to no modification (any issues should show up in the Compiler Errors and Output). The only downside is that, past AIR 2, there isn't any Linux support.
The other option is obviously to create a standalone .SWF projector inside a zip or installer, but in my opinion, that isn't the sleekest way to deploy for desktop. The advantage of AIR over this is that it gives you access to additional desktop functions that Flash Player doesn't.
I have a situation where I need to generate SWF from the FLA that user uploads on to the server. We use python and bash scripts, and work on Ubuntu Server 10.04 (64bit), any help on how to generate the SWF would be a great help.
Thanks.
Flash needs Flash IDE for compilation.
You probably can compile code using flex AS3 compiler on linux, but if there are graphical elements in Flash, you cannot compile them.
However, we had a similar situation, which we fixed by installing Flash in a MAC OS X Snow Leopard(10.6) and then wrote some php, some shell script, some applescript and made a command line compilation mechanism for AS3.
Mac OS X is a unix based os, so the command line is similar to any other unix. it comes with built in php, so you don't have to install anything.
Basically using script we dynamically generate something called .jsfl file. the jsfl contains the details of the .fla that needs to be compiled. these jsfl files can be executed by Flash IDE. so we invoke the flash IDE and pass on the generated .jsfl file. (http://gskinner.com/blog/archives/2004/08/jsfl_fla_batch.html)
This gskinner process works in windows also, but using mac we can make it command line. so that users can just ssh to the mac and execute the command to build the file.
FLA file format has changed significantly in the latest version of Flash. New FLAs are archives containing source files and assets, so you might be able to write a script unpacking a FLA and assembling an SWF from it. Prior versions of FLA contained proprietary format, not documented and there were no tools to process it in an automatic fashion, not on Linux for certain.
Depending on ActionScript version and your requirement to resource handling (by resources I mean images, fonts, sound tracks, videos etc) there are several options available:
Flex SDK, the material found in the blog post #ntidote refers to is somewhat dated, but it's OK / should work. You would need to consult MXMLC usage documentation to find out all available options (and some new required ones, not covered in the blog post). This is what you can do, if your goal is to compile AS3. This does not include video transcoding and you might find it challenging to embed vector graphics. MXMLC is, however, capable of compiling a large subset of SVG. It can also compile FXG - a new interchange graphic format that can describe vector shapes and text.
ActionScript 2 can also be compiled, but Flex doesn't offer a compiler for that. There is a very good, in fact a much better than the one written by Adobe, compiler for AS2: http://tech.motion-twin.com/mtasc.html .
There are other tools that are capable of generating SWFs - all depends on what exactly you need to do. Here's a good collection of different utilities: http://www.swftools.org/
Haxe is a whole other programming language that can compile to SWF. It also has its own linkers and ways of managing resources. http://haxe.org/
There is this project, which allows you to compile complex vector graphics and even animations from XML descriptions: http://code.google.com/p/hxswfml/
I have Flex Builder 3 and currently writing an Actionscript 3 program.
I attempted to import fl.motion package in my program and it could not be found when I ran it. This is the first time I am importing the fl.motion. Is that package available to FlexBuilder 3 users.
Yes, if you regularly own a FlashProfessional licence you can simply grab the the swc inside your Application folder. On Mac you might find it in /Common/Configuration/Actionscript 3.0/libs/flash.swc. Simply add the swc to your project references.
You must have Flash Professional in order to use fl.motion.* packages.
It is not part of Flex or the standard Flash library. It only comes with Flash Professional.
It is still possible to get these packages one way or another, but I think there may be some legal issues if you do not have Flash Pro in the first place.
Of course, if you have Flash Pro, you can use these libraries in Flash Builder.
If it is in order to move objects, there are some free or open source tween libraries available on the web, like Tween Max.