Can we use compiled Haxe swf's swc's in Actionscript as normal libs? - actionscript-3

Can we use compiled Haxe swf's swc's in Actionscript as normal libs? I have a swf compiled from haxe code (I can try to compile it into something else SWC for ex) I want to use it as lib in AS3.
Is it possible?
If yes how to do it?

Yes, you can, the performance increase is worth it, and it's surprisingly easy! I got 3-4X speed-up on both a simple sum-of-primes algorithm and a complex 2D bin packing algorithm.
I've posted an entire example project on github -- from Haxe source and compile scripts to usage in an AS3 project. Check it out: https://github.com/jcward/HaxeSWCExample
Update: Note that the 3-4X gains were on the desktop platform. Sadly on mobile platforms, the gains were much more modest.

Yes you can. If it is a library then you would want to export it as a SWC and then just make sure that where ever you are compiling from knows the path to the SWC.

Related

Running Flash (AS3) code in Haxe

I am starting out developing in Haxe in combination with OpenFl, and am in a situation where I need to be able to run Flash/AS3 code in a Haxe program which is being compiled to Flash anyway.
I know I could use the command lime build -as3 as3source/ and then edit that code and manually insert the AS3 code I need to run, but I would prefer not doing that if I can.
Is there any way to do this?
You can compile your AS3 code into a separate swf or swc and then use -swf-lib to use it from Haxe.
You can always write a build script which enters the code in combination with the command for you, if you just want to avoid doing it manually, but I belive that´s the kind of answer you want.
I just find build script very usefull.
You may want to look at this article, some major options are described there (including tools for converting AS3 code to Haxe and technique with -swf-lib).

AS3 OggVorbis - is there a precompiled SWC available?

I would like to use OggVorbis sound files in a flash project, and while I realize I can compile a SWC with crossbridge, that is a little over my head, so I was wondering if anyone knows of a ready to use SWC library available for download. I have googled this to death without much luck.
Alternatively, if anyone knows of a good walkthrough for compiling this library that would be great too. I have crossbridge set up and working, but when it gets to the part of making a swc interface I got a bit lost, and I'm on a time-table to get this working.
Thanks!
This one works pretty good, and has compiled SWC files.
http://labs.byhook.com/2011/02/22/ogg-vorbis-encoder-decoder-for-flash/

How to generate SWF from FLA using command line on Ubuntu Server?

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/

box2d for flash how to compile its examples?

http://box2dflash.sourceforge.net/
i downloaded the code and in its folder there is a examples folder. How can i compile them ? what are the other software i need and how can i do it? Please help me because iam completely new to the actionscript programming side.
It is explained in the Examples/Readme.txt
As quoted from the Readme
//
To compile the demo:
//
Flash: extract Box2DFlashAS3 and open
PhysTest.fla in Flash CS3 (9) and hit
Ctrl+Enter.
Flex: Create a new
ActionScript project and add all the files from the archive to the project.
Set Main.as to the default application and hit Ctrl+F11.
MXMLC: From the
"Examples" directory, run: mxmlc
-source-path=../Source/ Main.as;
Thus you have three different ways to compile.
Use Flash CS3 (or higher)
Use Flex Builder (or higher )
Use the Flex SDK that contains mxmlc
Only posting this as an answer because I can't post a comment... this is an alternative box2D implementation that uses alchemy (so much faster) but the real up-side to it is that it has plugins for the flash UI to visually design/create physical objects, including building worlds etc. Video tutorial explains where to download:
http://gotoandlearn.com/play.php?id=135

Flash ActionScript 3.0 - Any free compiler, tools and tutorials?

I have got an assignment in which I have to implement a AS3 wrapper for any FLV player and I have to expose actionscript functions (External Interfaces?) so that other can be used in other different applications via CallFunction API. I have few questions regarding this -
Are the tools for this are freely available? I know Flex SDK is but I want standalone swf (I means Flash Player 10) that can be used anywhere without any dependency and should contain FLV player embedded or should be able to load it from a particular location by supplying the URL.
Is it possible only with an ActionScript compiler (or any free tools?). My problem is that I don't have flash or flex builder and I don't want to spend money on these because I don't work on it.
As I have almost zero knowledge about it. Can you guys please explain me (if possible with details) that what I need to do. Any resoures on how to create and compile?
If any of you have ever done this it would be really great if you guys can share samples. I've heard that many people have done the same thing for video players.
I can share a bit of my setup
I use Flash (CS5) for creating assets
I use FlexSDK as the compiler
And do all the code in FlashDevelop
Flashdevelop is for PC only for now, it's free and comes since the last few versions now with a debugger
I use FlexSDK to compile and Eclipse with AS IDE or something along those lines, and then preview things in a web browser using an html page with the swf file embedded.
check out projectsprouts. its a pretty nice Flash (as2/3/Flex/AIR) generation tool that can help you stub out your project, compile it, and even create unit tests if you want. pretty simple ruby install (i am a ruby newb, and got is running pretty easily). It was a pretty good support base, and an active mailing list where people will be happy to help you along.
It is important to note that the FlexSDK has very little to do with Flex unless you are linking against classes that are Flex specific. mxmlc does not have anything to do with MXML even though it will also compile MXML.
Here is an article that describes Flash development on Linux. It is pretty old, but the principles are the same. With an Actionscript 3 Compiler (contained in the FlexSDK) and a text editor, you are off to the races. It is a lot easier with Flash Builder 4, FDT 4, Intellij IDEA, Flash Develop, etc ;)