TextMate and AS3
Continuing on the TextMate scripting tip, here's a quick and dirty compile command I whipped up for compiling AS3. This is based on a post at the Vixiom Axioms blog. Read on for the code, my Wordpress template won't render it properly on the front page...
Save: Current File
Input: None
Output: Show as HTML
Key Equivalent: Control-Command-M (scoped to source.actionscript)
CODE:
-
MXMLC=/Developer/SDKs/Flex/bin/mxmlc
-
OUTPUT="${TM_FILEPATH%.*}.swf"
-
FIREFOX=Firefox
-
-
compileResult=$($MXMLC 2>&1 -use-network=false -file-specs $TM_FILEPATH)
-
errorLine=`echo $compileResult | sed -n 's/.*(\([0-9]*\)):.*/\1/p'`
-
#echo $errorLine
-
-
echo "
-
<style type='text/css'>
-
body {margin: 10px; font-family: Courier New; font-size: 14px;}
-
a {color: #000000; text-decoration: none;}
-
a:hover {color: #666666;}
-
</style>
-
<script type="text/javascript">
-
function closeWin() {
-
self.close();
-
}
-
</script>
-
"
-
-
if test -n "$errorLine"
-
then
-
echo "<a onclick='closeWin();' href='txmt://open?url=file://$TM_FILEPATH&line=$errorLine'>$compileResult</a>";
-
else
-
echo "$compileResult";
-
open -a $FIREFOX $OUTPUT
-
fi







