Results 1 to 10 of 40

Thread: HOWTO : developing flex with gvim

Threaded View

  1. #1
    Join Date
    May 2006
    Victoria, Australia
    Ubuntu 12.04 Precise Pangolin

    HOWTO : developing flex with gvim


    for quite a few years I've been interested in flash, and have moved from developing flash stuff in the flash ide with no actionscript whatsoever, to doing stuff in the ide with an extensive amount of actionscript, to using a combination of just actionscript2 and kagswf (as in no ide ) to now using flex (actionscript3 and mxml)

    Anyway, it took quite a bit of searching to be able to do this in linux (more so when I was working with actionscript2 than with flex) and there is quite a few threads on this forum asking for ways to develop flash in linux.

    So I've decided to put down here how I've got gvim to play nice with actionscript3 and mxml.

    First download the flex3 sdk from here :

    then extract that to wherever you want, on my computer I've chosen :

    Then in the terminal, we need to make the mxmlc compiler executable :
    $ sudo chmod +x /usr/local/flex/bin/mxmlc

    then we need to make that folder part of your $PATH so that you only have to type "mxmlc" in the terminal to run it. To do this we first open this file /etc/bash.bashrc :
    $ gksudo gedit /etc/bash.bashrc

    (I'm not sure if this is the best place to put this (it doesn't work when i put it in ~/.bashrc), hopefully someone can clarify that )

    and add the following at the top :
    export PATH=${PATH}:/usr/local/flex/bin

    then when you have your flex project you can use mxmlc to compile your main mxml file (I assume you already know how to make a flex project, if not, this place here is a good place to start (it's where I started ))

    mxmlc usage is as follows :
    mxmlc [options] <target mxml file>

    Second we set up gvim to have proper syntax highlighting for the .mxml and .as files.

    here is my ~/.vim folder which holds the actionscript2, actionscript3 and mxml syntax files, as well as my custom colours file (you can use whatever colours you want) :

    then to make sure that the right syntax highlighting is applied to those files, make sure the following is in your ~/.vimrc file

    au BufNewFile,BufRead *.mxml set filetype=mxml
    au BufNewFile,BufRead *.as set filetype=actionscript
    syntax on
    and some nice things to have in your ~/.vimrc (unrelated to actionscript)
    set number
    set nocompatible
    set history=50          " keep 50 lines of command line history
    set ruler               " show the cursor position all the time
    set showcmd             " display incomplete commands
    set showmode            " display the mode you are in everytime
    set mouse=a             " mouse works in all modes
    set incsearch           " do incremental searching
    set showmatch           " balancing brackets like in emacs
    set wrap!               " linewrapping off
    set ignorecase          " evident
    set nostartofline       "to keep the cursor at the same horizontal location when
    set tabstop=4           " number of spaces that a <Tab> in the file counts for
    set laststatus=1        " show status line only if there are more than one windows
    set shiftwidth=4        " size of tabs by default
    set backup              "  backUps!!
    set title               "see filename in Xterm title
    imap ZZ <esc>:wq!<cr>   " ZZ saves and leaves as well in insert mode
    set autoindent
    set smartindent
    source $VIMRUNTIME/mswin.vim  " make it behave like windows
    Thirdly change the mime information so that you don't get annoying messages about the file not being the expected type when you double click .as files.

    Go into ~/.local/share/mime/packages (or create that directory first if it doesn't exist)

    then add a file called actionscript.xml with the following in it

    <?xml version="1.0" encoding="UTF-8"?>
    	<mime-info xmlns="">
    		<mime-type type="text/actionscript">
    			<sub-class-of type="text/plain"/>
    			<comment>Actionscript Source Code</comment>
    			<glob pattern="*.as"/>
    			<glob pattern="*.as2"/>
    			<glob pattern="*.as3"/>
    then add another file called mxml.xml with the following in it

    <?xml version="1.0" encoding="UTF-8"?>
    	<mime-info xmlns="">
    		<mime-type type="text/mxml">
    			<sub-class-of type="text/xml"/>
    			<comment>Mxml Source Code</comment>
    			<glob pattern="*.mxml"/>
    then do
    update-mime-database ~/.local/share/mime
    (if you want this to be a system wide setting then do the same, but in /usr/local/share/mime)

    Fourthly install the linux debugger flash player and the flashtracer extension so you can see trace statements

    first, download the debugger flash player from here

    Unpack it to the desktop, then unpack the archive found in the plugin/debugger folder, and run the flashplayer-installer file

    Then install the firefox FlashTracer extension, as found here

    and create a file in your home folder called mm.cfg and add the following to it
    (change "iambob" to your username)

    Then in the options for flashtracer, make the output file equal to the first line above, so for me it would be "/home/iambob/.macromedia/Flash_Player/Logs/flashlog.txt"


    Hopefully this has helped some people, I certainly would have liked to have this back when I started trying to figure out how to make this work

    have fun.
    Last edited by delfick; October 7th, 2008 at 04:01 AM.
    if u find some of my ideas weird...look at my avatar for the reason


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts