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="${TMFILEPATH%.*}.swf"
- FIREFOX=Firefox
- compileResult=$($MXMLC 2>&1 -use-network=false -file-specs $TMFILEPATH)
- errorLine=
echo $compileResult | sed -n <span style="color:#CC0000;">'s/.*(<span style="color:#000099; font-weight:bold;">\(</span>[0-9]*<span style="color:#000099; font-weight:bold;">\)</span>):.*/<span style="color:#000099; font-weight:bold;">\1</span>/p'</span> - #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