Monthly Archive for May, 2005

Page 2 of 2

Not related to programming or web-design in any way but…

Over the weekend my friend and I biked 66 miles across New Jersey, it was a blast. There was miles and miles of flat farmland, a car maybe came by once every 10 or so minutes. I’ve been in what some people would call ‘the middle of nowhere’ (upper NH), but this was seriously in the middle of nowhere, houses were spaced out a minimum of two miles away from each other.

Anyway, it was a great experience and I would highly recommend doing it sometime!

Average Rating: 5 out of 5 based on 236 user reviews.

I’ve released my first Cocoa application, Color Blender. I wrote it because I got frustrated when i couldn’t convert a hex value to a rgb value quickly and easily, this immensely slowed down my workflow when trying to pick out a color scheme for a new web-site. Hopefully you will find it useful too.

On a side note, a new version of CSS Optimizer, (renamed from Web Optimizer) which will have recursive directory searching support, and much better underlying filesystem support, among other things; is almost complete.

Average Rating: 4.7 out of 5 based on 211 user reviews.

I’ve devised a much better way of developing Flash with Xcode then what i previously posted. It uses the custom ‘Shell Script’ build phase in Xcode to call the Mtasc compiler. There are a number of advantages of this method over the applescript->Xmtasc->Flash Player route that was posted earlier:

  • If their is an error in your AS code mtasc will exit with a non-zero status, the shell script will exit with an error if mtasc exits with an error. This is really cool because when the shell script exits with an error the ‘Build Results’ window comes up and shows the output from Mtasc, if you double click on the error it will bring you right to line of the file where the error is; just like when you’re coding Objective-C or any other language that Xcode natively supports.
  • You can open up the compiled SWF with any SWF player of your desire.
  • You can easily switch between which SWF you currently want to compile by using the target’s pop-up menu in Xcode.
  • The standard ‘Build’ button now works! This means that cmd+b will build your project, unfortunarly the ‘Build & Run’ button wont work, it will build the swf but will give you an error when Xcode tries to open it up.

To put this whole system together is fairly simple, you could just download a already made sample project with the shell script build phase already put in place, or follow the following directions:

  1. Get the Actionscript Specification
  2. Create a new empty Xcode project. In Xcode go to File->New Project and select ‘Empty Project’. Create a basic project structure that is generic to all your Flash projects, just as directed on the diretions from Pixel Consumtion.
  3. Go to ‘Targets’ item on the left side of Xcode. Right click on it, from the contextual menu choose Add->New Target, then from the target window choose ‘Shell Script Target’. Name it whatever you please.
  4. Once the new shell script target has appeared in your ‘Targets’ menu, click the little arrow on the newly created target, you should now see an item named ‘Run Script’. Click on it then press cmd+i. Under the ‘Script’ section paste this script:
    #simple compile and view script for MTASC
    
    #global vars,  swf = the target swfs name,  swfplayer = the name of the swfplayer
    swf="./main.swf"
    swfplayer="SAFlashPlayer"
    mtasc=/Applications/mtasc/mtasc
    
    #compile the swf
    $mtasc classa.as classb.as /class/ina/dir.as \
    -cp "/A Class Path" -cp /Applications/mtasc/std -swf $swf
    
    #check for errors
    if [ $? != 0 ]
    then
        exit 1
    else
        open -a $swfplayer $swf
        exit 0
    fi

    There are three variables that are important in this script:

    • swf. The $swf variable is the path to the swf you are going to be compiling.
    • swfplayer. The name of the application that you want to play your swf.
    • mtasc. The path to your Mtasc binary.
  5. Save the project, close it, then copy it to:
    /Library/Application Support/Apple/Developer Tools/Project Templates/Flash/

Your project should come up in the options for File->New Project (you might need to restart Xcode- not sure). You should be able to define the global variables and build your swf. To add the ability to compile different swfs just duplicate the original target and define the variables in the swf. You could even add a custom phase to script for building a Swfmill library. Although this system works fairly well, there is still no debugging without traveling back to the Flash IDE, which is a very big problem. Fortunatly there are a few options:

  • Ricci Adams has created a great Open-Source app, Swf Console which works great and provides a nice GUI for Swf Dump, Flasm, and Flare.
  • The almighty Admin Tool.
  • A simple Debug Class I made.

Those are the main choices I am aware of. I personally use my debug class since its very light weight and is built into the swf. Just simply call debug.trace(“something”+var); to trace ouput.
Hopefully you’ve found some of this info usefull!

Average Rating: 4.5 out of 5 based on 205 user reviews.

I’ve successfully finished my site for the May 1st Re-boot- almost. There are still a few loose ends I have to tie up with the site, including finishing the portfolio section & making my HTML site valitate correctly; but for the most part its done. Hopefully i’ll have more time to work on this site now, I have a bunch of stuff I have to share.

On a side note, I’ve received Apples new OS- 10.4 Tiger. Quite simply, its incredible. The best feature that I’ve found so far is the speed, my mac feels like it just gained 200+Mhz, the UI and the file system are incredibly faster.

Average Rating: 4.9 out of 5 based on 258 user reviews.