box2d for flash how to compile its examples? - actionscript-3

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

Related

Coming from a Flash Builder background, how can I import a library into IntelliJ IDEA?

the only IDE I've used for many years was Flash Builder. Sadly the 4.7 version is in a poor state, so, I started looking at other IDE's lately.
I'm trying IDEA, but I don't know how to add a library to my project.
In FB it was simple, I go to the compiler settings and I just add a folder or swc. But here, it seems like there are 2 options, one under the "Libraries" tab and other is creating a new module, however, this new module requires a main app, SDK, and a lot of other stuff that doesn't make any sense to have in a library.
So, what is the equivalent of adding a library path here?.
Thanks.
"Libraries" is the correct way to do it. There are two kinds of libraries: libraries and global libraries. Global libraries can configured once and used in every project. Libraries are configured for each project. See http://www.jetbrains.com/idea/webhelp/configuring-project-and-global-libraries.html

FDT - Where is new Flash Project?

Up until this point I have been doing all of my coding in sublime text 2, and compiling with flash pro cs6. I have gotten pretty good with actionscript 3. I have been uing the mvc design pattern and used external libraries like admobs and electroserver. The real reason why I got fdt and wanted because I wanted to play a source file I downloaded in which the document class was mxml.
In every tutorial though I see them say, "oh just click new flash project". the problem is though that there is no choice "flash project" There is only actionscript project and fdt project or fla.
In flash ide I would use one .fla as a "shell" to publish from, and have another .fla with the assets that would be embedded in as3 from its swf. I'm sure that's not the way to set up files in fdt, but I dont know the right way to do it, or even the right way to start.
Maybe I am not finding the right page, but it seems that the documentation on the site is pretty weak. Are there good tutorials somewhere that will help me start compiling projects? thanks
A tutorial specifically for people transitioning from flash ide to fdt would be helpful too.
I could be wrong, but from this IDE, you can't compile fla.
Instead of this, it provides another approach to build projects.
You have to start "new FDT Project", select base and set main class,
which must be compiled.
In result this approach more flexible and convinient.

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/

How to package library in ActionScript3 (.jar equivalent?)

I am creating a library in AS3. Inside the library I make use of a bunch of classes/packages that need not be exposed to the end user of my lib. I want to only expose one of these classes.
I guess my questions are:
1) How are libraries commonly distributed in AS3?
2) Is there a .jar equivalent in AS3 that developers can include, but will only have access/knowledge of the classes I've declared as public?
Thanks!
AS3 libraries are called SWCs. Like JARs they are just ZIP archives with some metadata included. You can build libraries either using Flash Builder library projects or mxmlc compiler in Flex SDK which is described for example here.
Good practice is to distribute SWC or source code. With docs or readme file of course.
Is it possible to create a SWC file without using the Flex framework?
I just want bare-bone AS3.
Yes we are not forced into using flex, in fact Adobe doesn't even support Flex as their product officially anymore as it is now an open-source apache project. http://blogs.apache.org/flex/
The compiler itself for flash is open-source and free to use, that is why there are many third party IDEs and development tools that can also produce SWC libraries. The compiler just requires a special xml file in a zip in order to make a swc. So if you want to avoid doing this manually to the spec its just a matter of choosing a gui way to do this.
One of the most popular one open-source gui ways atm I believe is Flash Develop http://www.flashdevelop.org/ which has a plugin to do what you want. http://www.flashdevelop.org/community/viewtopic.php?f=4&t=2987
This IDE is highly recommended but if you need something more cross platform, I recommend Intellij Idea which is a great as3 and java ide, since you know what jar files are.
"only have access/knowledge of the classes I've declared as public?"
The classes in your swc will be no different to being part of your main project so if you create a swc with public or private it will be public or private the same way. To be honest though most code shared by blogs and repositories in the community are just raw *.as files, swc is handy however for shared libraries in a team and can make this more organised.

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 ;)