Tuesday 2006/09/12
4:24 PM

Categories: Flash/Actionscript, TextMate

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:
  1. MXMLC=/Developer/SDKs/Flex/bin/mxmlc
  2. OUTPUT="${TMFILEPATH%.*}.swf"
  3. FIREFOX=Firefox
  4.  
  5. compileResult=$($MXMLC 2>&1 -use-network=false -file-specs $TMFILEPATH)
  6. 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>
  7. #echo $errorLine
  8.  
  9. echo "
  10. <style type='text/css'>
  11. body {margin: 10px; font-family: Courier New; font-size: 14px;}
  12. a {color: #000000; text-decoration: none;}
  13. a:hover {color: #666666;}
  14. </style>
  15. <script type="text/javascript">
  16. function closeWin() {
  17. self.close();
  18. }
  19. </script>
  20. "
  21.  
  22. if test -n "$errorLine"
  23. then
  24. echo "<a onclick='closeWin();' href='txmt://open?url=file://$TM_FILEPATH&line=$errorLine'>$compileResult</a>";
  25. else
  26. echo "$compileResult";
  27. open -a $FIREFOX $OUTPUT
  28. fi

Comments are closed.