Archive for the ‘Flash/Flex’ Category

Continuous Integration with Flex 2 (Actionscript 3), FlexUnit, CruiseControl, Apollo and subversion on OS X

Tuesday, April 24th, 2007

Here are the steps I went through to get CruiseControl working with Flash Actionscript 3 (AS3) and Flex 2.
Most of this information can be found around the internet (eyefodder tutorials). The main additions I've contributed are putting all the information in one place and using Apollo to run testcases and output the pass/fail data.
These steps are for OS X but should be close to the same for any other os that the Flex 2 sdk will run on. The main changes would be the svn server and client install and paths in the ant build file.

Overview
1. Install the Flex 2 SDK and the Apollo SDK
2. Create a simple Actionscript 3 app.
3. Install FlexUnit and create a test case.
4. Instal svn server
5. install svn client
6. Create an Apollo app that outputs unit test result xml for CruiseControl
7. Create build files for building the HelloWorld app and Apollo test app.
8. Add the project to svn
9. Install and setup CruiseControl

Install the Flex 2 SDK and the Apollo SDK

1. Download the Flex 2 SDK from here: http://www.adobe.com/products/flex/sdk/
2. Put the sdk here on your ma (more…)

Using javascript as your shell script language.

Monday, October 16th, 2006

I'm currently developing applications for Pocket PC and Smartphone which means I spend a lot of time on a Windows box away from OS X. Recently I needed to create a bunch of event class files that were all very similar. Rather than create each one by hand I wanted to automate their creation with a script. On my mac I would use Rhino and create the script in javascript. While jscript is easy to use on Windows, I wanted to use Rhino so my scripts would work on both OS X and Windows.
Here is how I got Rhino to work on both platforms:

First, the OS X install instructions. I found instructions on Mike Chambers blog and modified them a little.

1. Download Rhino from here:http://www.mozilla.org/rhino/download.html
2. In the root directory there is a file called js.jar put it in ~/Library/Java/Extensions. If the directory doesn't exist then create it.
3. Add this line to the .bash_profile in your home directory: alias js='java org.mozilla.javascript.tools.shell.Main'

Rhino should now be installed. To test it:
1. Create a file called helloWorld.js that contains the line: print("hello world");
2. Open a terminal window, navigate to the directory where you saved helloWorld.js and type "js helloWorld.js"

Thats it. You should see "hello world" displayed in the terminal.

Now for Windows. I wanted the same functionality; type js on the command line to access Rhino.

1. Download Rhino from here:http://www.mozilla.org/rhino/download.html
2. In the root directory there is a file called js.jar put it in C:\Rhino. If the directory doesn't exist then create it.
3. Create a file called js.bat, save it in C:\Rhino and put this script in it:

@echo off
if "%OS%"=="Windows_NT" @setlocal
if "%OS%"=="WINNT" @setlocal

set JS_FILE=%1
shift
set LINE_ARGS=%1
if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
set LINE_ARGS=%LINE_ARGS% %1
shift
goto setupArgs

:doneStart
java -jar "C:\rhino\js.jar" %JS_FILE% %LINE_ARGS%

if "%OS%"=="Windows_NT" @endlocal
if "%OS%"=="WINNT" @endlocal

4. Add C:\rhino to your class path. (Setting classpath instructions)

Your set. You can now use javascript on both platforms for all your pragmatic scripting needs.

ActionScript 3 Hello World using Eclipse on OS X

Saturday, July 1st, 2006

Here are some quick steps to compiling a simple actionscript 3 swf using Eclipse. This should work using any OS although you would probably need to change the ant build file to use mxmlc.exe if on Windows.

1. Download the Flex 2 SDK from here
2. Move the downloaded files to /Developer/flex_sdk_2
3. Create a simple project in Eclipse
4. Add new file to the project and name it "build.xml"
5. Add this code to the build.xml file:

< ?xml version="1.0" ?>
<project name="dar" default="build" basedir=".">
        <target name="build">
                <exec dir="." failonerror="true" executable="/Developer/flex_sdk_2/bin/mxmlc">
                        <arg line="HelloWorld.as" />
                </exec>
        </target>
</project>

6. Add a new file to the project and name it HelloWorld.as
7. Add this code to HelloWorld.as

package
{
        import flash.display.MovieClip;
        import flash.text.TextField;
       
        public class HelloWorld extends MovieClip
        {
               
                public function HelloWorld()
                {
                        var helloDisplay:TextField = new TextField();
                        helloDisplay.text = "Hello World";
                        addChild(helloDisplay);
                }
        }
}

8. Right click on build.xml and run it has ant build 1. Right click on file -> Run As -> 1 Ant Build
9. Right click on the project folder and select refresh. A file named HelloWorld.swf should be added.
10. Open the swf and watch the hello world goodness be shown.

Back from the dead

Sunday, November 6th, 2005

I hate to use the I've been busy excuse but…
Quite a lot has happened in the last four months and posting here just stopped happening.
A quick update on my professional Flash life:
First I stopped working at Adobe. It was one hell of a ride and I couldn't have asked for a better group of people to work with but the time came to move on. Immediately after Adobe I started working as Flash developer for a company called Composer. Recently I was promoted to a Senior developer. I spend all day, every day developing with Flash. And all of this in 3 months! Things have been moving fast but I'm loving every second of it.
The first post after a long break is always the hardest. I'll be back soon ;)

MTASC as your Xcode actionscript compiler!!!

Wednesday, May 11th, 2005

It's finally here!! A major piece to the all external xcode flash ide has been created. Thats right, mtasc (Motion-Twin ActionScript 2 Compiler), a stand alone actionscript compiler. Ok.. so this post is a couple months late and mtasc has been out for a while. I've been a little out of the flash loop for the past couple months working at a job that doesn't involve all things actionscript.
One of the great things about using mtasc with xcode is that it adds syntax checking. No longer will you need to remember line numbers and move back and forth between flash and xcode.

Here are the steps I took in getting xcode to compile using mtasc: (more…)

Portfolio site code and dev files online for download

Saturday, April 2nd, 2005

Interested to see how I created my portfolio site? Well now you can. The entire thing, .fla's, .as's, .html's, .swf's, all of it is online to be downloaded and picked apart. If you do look at it please drop me an email and let me know. Questions, concerns, critiques, opinions, ideas, hate mail or praise mail, send it all my way.

Click here to download it (6.4 MB)

All of it is licensed under the CC-GNU GPL

Flash contest (animation, game…)

Thursday, March 3rd, 2005

Here is a flash contest I heard by way of moveon.org. The theme probably isn't for everyones but the powerbook prize is nice for all and I'm sure some funny animations will come out of it.

Flash, Naturaldocs and Xcode

Tuesday, January 25th, 2005

Flash Ant was successful in their campaign to get full actionscript support in Naturaldocs.

Here is a quickie on how to get NaturalDocs to work with Xcode.

First fallow this tutorial on making Xcode your Flash IDE.

Then follow these directions to make Xcode run a shell script when building projects.

1)Download Naturaldocs.

2) Put the downloaded NaturalDocs folder in /Developer.
make sure the name of the folder is "NaturalDocs"

3)In one of your current Xcode flash project folders, create a folder called "_00Settings" and another called "_06Documentation".

4)Open op the Xcode project.

5) Add this line to the shell script of the build target: (see this tutorial for help)

/Developer/NaturalDocs/NaturalDocs -i _04Production/ -o HTML _06Documentation/ -p _00Settings/NaturalDocs

6) build the project then look in the "_06Documentation" to see your NaturalDocs spoils.

Flash NaturalDocs support

Tuesday, January 18th, 2005

I wanted to help spread the word that Flash Ant is leading a great petition to get NaturalDocs support for actoinscript. Flash Ant will donate $1 for every email sent asking for actionscript to be included.

New portfolio site is live

Friday, December 24th, 2004

A couple weeks ago I got a horrible case of poison oak. My face was so puffy my eyes were almost swollen shut and I didn't recognize myself in the mirror. I went to the doctor and was prescribed medication that wouldn't let me sleep. So for a week I got from zero to four hours sleep each night. To keep from itching a hole in myself I built this, a New portfolio site.

More Xcode for Flash customizing

Saturday, December 11th, 2004

Currently the Xcode setup I have for working on my flash projects forces me to save all unsaved code files before Xcode tells flash to compile everything. I wanted to have the Xcode build functionality which can automatically save files before each build.

Xcode has a nifty build process that allows you to add custom shell scripts to it.

This is how I added the save functionality: (more…)

JSFL helpfulness

Saturday, December 11th, 2004

Most of the projects I work on include many separate swf files that are loaded in at run time. This can be a pain because you have to publish multiple fla's each time you want to test the project. BIT-101 had a helpful answer to this using JSFL. BIT-101's solution works great if your only working on two files but I wanted something that would work on multiple files so I came up with this:

fl.outputPanel.clear();
fl.saveAll();
var currentWindow = fl.getDocumentDOM();
for(var a = 0; a < fl.documents.length; ++a){
    if(currentWindow != fl.documents[a]){
        fl.setActiveWindow(fl.documents[a]);
        fl.documents[a].publish();
    }
}
fl.setActiveWindow(currentWindow);
currentWindow.testMovie();

I ran into a problem where all the movies published were also tested all at once inside the same window. Im not sure what was going on there but making each document active before publishing it seemed to fix it.

BIT-101 bound the script to the F7 key. I added it to the JSFL script executed by hitting command-enter in Xcode as shown in the oh so helpful Xcode for flash tutorial.

Next up is to write an Xcode script that saves all unsaved actionscript files before telling flash to publish everything. But that will be for tomorrow… err… make that later today.

Xcode as your Flash IDE!!

Saturday, November 20th, 2004

Finally A real IDE for Flash on OS X!!!

Pixelconsumption has a great tutorial on how to set up Xcode to work with Flash. Its got the syntax highlighting, "command enter" integration with flash to run your project and all the awesome features of Xcode.

vEngine Structure Collision

Saturday, November 13th, 2004

This is an explanation of how vEngine deals with structure collisions. Structures refer to all static objects, like the ground and walls.

Warning!! This document is far from complete.
(more…)

Sites using Actionisms

Friday, November 12th, 2004

Actionism is one of my flash projects.

My portfolio site uses Loadism and the unreleased 3Dism.

Terence Ranger uses Loadism

Tim Gallaher uses Musicism