This is the old (static) wiki. Please go here instead |
by Dominique PERETTI
This tip allows you to compile-and-test your Flash ActionScript 2.0 project from TextMate. You’ll get the Flash IDE errors in a TextMate window !
1.1 update : new error formatting : click on an error and be brought to the right file, at the right line !
#! /bin/sh
# version 1.1
# Author: Dominique PERETTI
# http://www.lachoseinteractive.net
url=http://127.0.0.1/~dom/alahup/sites/lachose/admin/editor/
fla=/Users/dom/Sites/alahup/flash/_apps/alahup/Editor.fla
swf=/Users/dom/Sites/alahup/engine/Editor.swf
swftmp=/tmp/Editor.swf
flashcommand=/Users/dom/Shell/flashcommand
if [ "$1" == "relaunch" ]
then
/usr/bin/open "$url"
exit 0;
fi
result=`"$flashcommand" -e -s "$fla" -o "$swftmp"`
test=`echo "$result" | grep -c Error`
if [ "$test" != 0 ]
then
#flashcommand output is very dirty and windoze like. Let's format it !
echo $result | perl -p -i -e "s/\s*\*\*(Error|Warning)\*\*\s*/\n/g;" | perl -p -i -e "s/Total ActionScript Errors.+//g;" | awk 'BEGIN {FS=": Line "} { a=$1; b=$1; gsub(":","/",a); gsub("^.+:","",b); print a":"b":"$2}' | perl -p -i -e "s'^(.+?)/'/';"
exit 1;
fi
cp "$swftmp" "$swf"
if [ "$1" == "launch" ]
then
/usr/bin/open "$url"
fi
exit;
Name : Build
Shortcut : Command-B
Command : $TM_PROJECT_DIRECTORY/build.sh launch
Before running command : Save modified files in project
Standard input : None
Standard output : show in separate window
Pattern : ^(.+):(.+):(\d+):(.*)$
Format string : $2, line $3: $4
File register : 1
Line : 3
Column :