Tag Archives: AIR

Alternativa Class Generating AIR App

Through my recent experience with Alternativa, I can say hands down that getting your model out of the 3DS file format and into AS classes is simply the way to go. Yes, having classes that are thousands upon thousands of lines of nothing but vertex creation is kind of lame; but the performance gain from it is completely worth it. Especially when you consider that complex models take on the order of 10 seconds or more just to load from 3DS into your scene. I’ve seen some of these models load from AS classes in a third of the time.

So we have a function given to us in the API to generate a class from a mesh object, the generateClass() method. It creates a string which represents the entire class written out. But for models with multiple meshes contained in a hierarchy, it would be nice to have something create these classes automatically. So, I created an AIR app that does just that. Given a directory and a 3DS model, it will take the 3DS model, parse all of the meshes, and allow you to edit mesh names. Once you are ready, it writes the files out to the directory you choose. It will (hopefully) ignore all non-mesh objects, and will even create directories for multiple meshes contained within a parent mesh. Its a free app, do what you want with it. Just remember that you use it at your own risk, there is no warranty and though I will do what I can to help those with problems I may not have the time to fix every issue.

Now then, with that out of the way… To use it, simply install the AIR app (download the AIR or zip file here). Once you’ve installed and opened it, click the choose directory button:

Open Directory Image

After you’ve chosen the directory, click the Choose 3DS File button:

Choose 3DS File Image

Once you’ve chosen both, you can edit mesh names and then export your files by clicking the Create Classes! button. Here is a short video showing how it works:

Example of Alternativa Class Generator

Creating an Actionscript based AIR project in Flex Builder

The majority of the work I do is pure ActionScript, and doesn’t require the Flex framework. Its inevitable that someday one of these ActionScript projects will need to go local. In the past Zinc would have been the choice, but even the first version of AIR beats it considerably. So what do you do if you have an ActionScript project you want to do in AIR? It turns out that Flex Builder doesn’t have an option to create an ActionScript based AIR project. Luckily I’m not the only person who has run into this problem, there is an entry in the Adobe bug system detailing this exact issue. In the comments, there is a post that details exactly how to set up an ActionScript based AIR project in Flex Builder.

All you need to do is create a new Flex project, and change a file extension right before finishing set up. Once you name the project, click next. After you select the output directory, click next again and in the source path screen change the extension on the main application file from mxml to as.

Change the extension

After the project is created, you need to add code to have the project do anything (even create a window). Since its not done by default, here is some code to create a simple window:


var mainWindow : NativeWindow = new NativeWindow( new NativeWindowInitOptions() );
mainWindow.activate();

Thats it, thanks to Laurenţiu Lozan for the solution!