Skip to content
This repository

ActionScript 3 TextMate Bundle

branch: master
README.mdown

TextMate ActionScript 3 Bundle

A TextMate bundle for working with ActionScript 3.

Features:

  • Autocompletion system (experimental)
  • MXMLC and FCSH Build Commands.
  • ActionScript 3 and Flex documentation search.
  • Drag and Drop of imports, includes, embed assets, css, xml.
  • ASDoc Support.
  • Class and Component Templates.
  • Shortcut's to open Super Class, Code Behind and Import file.

Installation

Via download:

  • Open this link
  • Unzip the download
  • Rename the folder to ActionScript 3.tmbundle
  • Double-click
  • TextMate handles the rest!

To install via Git:

    cd ~/"Library/Application Support/TextMate/Bundles/"
    git clone git://github.com/simongregory/actionscript3-tmbundle.git "ActionScript 3.tmbundle"
    osascript -e 'tell app "TextMate" to reload bundles'

Source can be viewed and forked via GitHub

SDK

This bundle is designed to work with the Flex SDK (to build using the Flash IDE you should also install the Flash.tmbundle). For full functionality it is necessary to download and install the Flex SDK. Bundle commands will search the following directories to attempt to find the SDK automatically:

This list only shows when this document is viewed via Bundles > ActionScript 3 > Help

If you do not place the Flex SDK in one of these directories then you need to set the TextMate shell variable TM_FLEX_PATH to your chosen directory. Please note that if you have added [flex_sdk]/bin to your PATH manually only the build and compile commands make use of it, and the documentation, source code, and configuration commands will fail.

Documentation

Documentation is not included with the SDK so has to be installed separately for the documentation command to work. You can download it from this page, or directly as a zip file. Once downloaded please rename the unzipped directory docs and place it in your Flex SDK directory.

Flash Player

A full archive of flash players can be found here, debugger versions of the player are needed to trace output and display runtime errors.

Conventions

ActionScript formatting follows the guidelines Adobe use for the Flex SDK.

For Bundle conventions please follow the TextMate conventions.

Commands

Auto Complete

Target: Current Line
Key Equivalent: ⌥⎋
Currently in an experimental state but may provide full auto completion based on the current property chain.

Auto Complete Function

Target: Current Word
Key Equivalent: ⌥⎋
Attempts to auto complete the function you have partially typed.

Auto Complete Import

Target: Current Word
Key Equivalent: ⌥⎋
Attempts to auto complete the import statement for the word you have partially typed.

Build

Target: Active Project
Key Equivalent: ⌘B
Builds the currently active project. The project needs to be correctly configured by setting the TM_FLEX_FILE_SPECS and TM_FLEX_OUTPUT environmental variables. See the configuration options below.

Compile Current Class

Target: Selected file or the active file if it doesn't belong to a project.
Key Equivalent: ⇧⌘B
Compiles using mxmlc.

Documentation Block

Tab Trigger: doc
By default this will open an Asdoc block. When invoked one a line directly preceeding a class or method statement output will act appropriately.

Documentation for Word / Selection

Target: Current Word
Key Equivalent: ⌃H
Searches the help files for the selected word.

Function

Target: Current Word
Key Equivalent: ⇧↩ Creates a method using the current word as the method name. Additionally if the current word starts with 'on' or 'handle', or ends with 'Handler' an event parameter is automatically injected into the method.

Getter/Setter

Target: Current Word
Key Equivalent: ⌃⌥G
Creates a get set method pair from the selected word. If there is no current word then the command searches the document for private and protected variables and presents them as a list. Selecting an item from the list will generate the accessor.

Import Class

Target: Current Word
Key Equivalent: ⇧⌘I
Generates and inserts an Import statement based on the word the caret is currently placed at. The word may be a full or partial class name, where more than one match is found a list will be presented to choose from.

Open...

Target: Current Word
Key Equivalent: ⇧⌘D
Attempts to locate the class the caret is currently on and open it.

Remove Unused Imports

Target: Current Document
Key Equivalent: ⇧⌃I
Removes any import statements who's class is not referenced elsewhere in the document. Please note that wildcarded.* packages are not removed and that packages containing more than one class will not work.

Run

Target: Current Project or Document
Key Equivalent: ⌘R
Attempts to open or execute TM_FLEX_RUN_FILE, TM_FLEX_OUTPUT, TM_PROJECT_DIRECTORY/deploy/index.html, or TM_FILEPATH.swf.

Configuration Options

These environment variables allow you to define or customise the behaviour of certain commands. For help on setting them up please see TextMate help. To view the defaults for certain variable look at TextMate > Bundles > ActionScript 3 > Settings.

  • TM_FLEX_PATH
    The path to your Flex SDK installation directory. If it is not in one of the default locations (see Installation section).

  • TM_FLEX_FILE_SPECS
    The project directory relative path to the file to compile. Ideally this should be a Project Dependent Variable

  • TM_FLEX_OUTPUT
    The project directory relative path of the swf or swc file to create when you compile. Depending on the target output the build task will appropriately choose to use mxmlc or compc. Ideally this should be a Project Dependent Variable.

  • TM_FLEX_BUILD_FILE
    The project directory relative path to the build file you wish to use to override default behaviour (triggered by ⌘B).

  • TM_FLEX_RUN_FILE
    The full, or project directory relative, path to the file you wish to open or execute to override default run behaviour (triggered by ⌘R).

  • TM_ORGANIZATION_NAME
    Name used in copyright notices in most templates.

  • TM_ASDOC_GENERATION
    If you would like asdoc blocks automatically inserted when using commands, snippets, and templates then enable this variable and set this value to anything. Please note this feature is currently being added and therefore not always available.

  • TM_AS3_BANNER_GENERATION
    To have code banners inserted into the class templates set the value of this variable to anything.

  • TM_FLEX_USE_FCSH
    Set this property to anything if you wish to compile using fcsh. This will give you the added benefit of compiler caching and should be noticeably faster, especially on larger projects.

  • TM_FLEX_BACKGROUND_TERMINAL
    If you are compiling using fcsh and the terminal setting this to anything will stop the switch from TextMate to the Terminal when you build.

  • TM_AS3_USUAL_SRC_DIRS
    Colon separated list of directories within which the bundle may find source files.

  • TM_AS3_TEMPLATE_BUNDLES
    Pipe separated list of Bundles to search when finding templates.

  • TM_FLEX_SDK_SEARCH_PATHS Colon separated list of directories the bundle uses to try and locate the Flex SDK when it has not been explicitly defined by the user in TM_FLEX_PATH.

Known Issues

  • fsch doesn't accept escaped or quoted directory names properly, if they have space it fails. The only solution is to use paths that don't contain spaces.

  • TextMate 1.5.9 (1589) broke all commands scanning the project for files. To fix the issue you need to upgrade your TextMate Support directory to the most recent version. To do this checkout http://svn.textmate.org/trunk/Support to /Users/$USER/Library/Application Support/TextMate/Support

Support

For general questions please use the TextMate Users mailing list.
Bugs and issues should be reported via the issue tracker.
Source can be viewed and forked via the GitHub repository.

Maintainer

Simon Gregory

Contributors

Chris Jenkins
Christian Swinehart
ChromaticRain
Daniel Parnell
Gabriel Laet
Jeremy Sachs
Joachim
Kristofer Joseph
Lars van de Kerkhof
Leo Soto
Lucas Dupin
Luke Daley
Mark Llobrera
Theo Hultberg
Thomas Aylott

License

If not otherwise specified (see below), files in this project fall under the following license:

    Copyright 2007-2010 Simon Gregory

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar.

Something went wrong with that request. Please try again.