views:

253

answers:

2

I would like to do some Flash development on my MacBook, utilizing the Flex 3 SDK to compile Actionscript 3 into SWF movies.

How would I set up my Mac to do this?

I would also like to understand how the flash compiler interprets package names into a directory structure.

I took a Flash class in high school, but it relied very heavily on the use of the Adobe Flash IDE, and focused very much on graphical development as opposed to programming and OOP.

I would like to, for example, have an Application class, which would serve as the stage, and multiple other AS3 classes to serve as other MovieClips, Sprites, etc. When I build/compile, all classes in the project directory should be built into a single .swf file.

Is this situation realistic? Achievable? If so, how do I get there?

Thanks!

A: 

well, i'm a windows user, but from what i undestood, most mac actionscripters go with TextMate ... i incidentally saw it in action in some tutorial and it made a good impression ...

other than that, i don't know ... you might wanna virtualize windows xp or so, and get FlashDevelop running (seriously, a lot of mac users actually do that!), which in my opinion is the best actionscript editor around, and probably the most important reason why i am sticking to windows actually ... :D

with both tools what you want to do should work easily ...

hope that helps ... ;)

back2dos
+1  A: 

What is your technical background Austin? If you are coming from a pure art background then it may be a little more difficult to explain everything you need.

First, you need to download the Flex SDK. When you uncompress the directory you get from the download you will see a folder bin. Inside the bin are a number of executables that can be used to compile Flex. The one you want is called mxmlc. You can link that into your /usr/local/bin or just add the folder to your PATH.

If you create a simple file:

package
{
import flash.display.Sprite;

public class TestSWF extends Sprite
{
    public function TestSWF()
    {
    }
}
}

save it anywhere (I'll use /tmp/flash/) as TestSWF.as

From the Terminal command prompt type:

mxmlc TestSWF.as

You'll see the output:

Loading configuration file ......
/private/tmp/flash/TestSWF.swf (561 bytes)

To compile another file create another directory:

mkdir model

Make a new file in that new model directory called TestModel.as

package model
{
import flash.display.Sprite;

public class TestModel extends Sprite
{
    public function TestModel()
    {
    }
}
}

Note how the package definition has the name model and the directory name is also model. That is how packages work. The package name matches the directory name. If you go deeper into directories (e.g. model/helper/FileLoader.as) then the package name switches the directory / for a period (e.g. import model.helper.FileLoader)

Change TestSWF to be:

package
{
import flash.display.Sprite;

import model.TestModel;

public class TestSWF extends Sprite
{
    public function TestSWF()
    {
        var model:TestModel = new TestModel();
    }
}
}

once again run:

mxmlc TestSWF.as

You'll see the output:

Loading configuration file ......
/private/tmp/flash/TestSWF.swf (561 bytes)

mxmlc will automatically find the class model.TestModel because it by default includes the main files root directory in the class path.

This is the most basic possible way to compile files. It will serve for testing, playing around and very small projects. If you plan to develop professionally or very large projects I suggest using a better IDE (e.g. Flex Builder) or at least a decent build system (e.g. ant). The main advantage to Flex Builder or other Flex specific IDE's is that they hide a lot of the complexity that is normal when building/compiling software.

James Fassett
Thanks, I'm actually from a web development background, but very new to not using a full IDE like Flash IDE, or doing much of anything like compiling on my new mac. This helped a TON!
Austin Hyde