Flash MiniBuilder: Online AS3 IDE – Part I


Flash MiniBuilder: online AS3 IDE, edit (with code assist) and compile swf online.

Later Edit: Desktop Flash MiniBuilder is out! http://www.victordramba.com/?p=36

Flash MiniBuilder Part I
Flash MiniBuilder Part II
Flash MiniBuilder: Part III – AsWing

This project, currently named ActionScript MiniBuilder, features code assist (code completion) for ActionScript 3 and compilation of one-file AS3 SWF. It runs in your browser, you only need Flash Player 10 and Java. The code assist part is written in pure ActionScript. The compiler runs in a Java applet.

Though it’s in early stages, the currently implemented set of features includes:

  • Solving existing names: the resolver searches recursively the current and parent scopes, the inheritance chain and imports.
  • Hints for new names: the resolver searches scope, inheritance and all importable things – that can be class, interface, functions and vars defined at package level.
  • Hints for new types. (class/interface): the resolver looks in all type database.
  • Autoimport: when a name can’t be resolved in scope and existing imports, and can be resolved by using a new import, the new import is added to script.
  • Triggers: several chars and char sequences trigger the code assist hinting as follows:
    • “.” -> list members
    • “:”, “new”, “as” -> list all possible types
    • “(” -> hint function/constructor parameters
  • Simple expression evaluation (just 2 for now):
    • ’string’ and “string” are of type String and hinted accordingly
    • (expr as Type) is evaluated as Type and hinted accordingly

So you can have things like:

(value as Type1).doSomething().memberName.doOtherSting().otherName

resolved correctly.

Now, let’s play!
Here’s a first example (edit source then click “Compile and Run”):

Note: for code completion, flash player is enough, but you need Java plugin in your browser to be able to compile/run. The compilation is done at client-side, so don’t worry about server load. Have your time and play with it as long as you wish. You can bookmark this page to use it whenever you think Flash or Eclipse starts too slow for a simple script.

What’s next:
- A project manager for multi-file projects.
- A swc parser to provide hinting for external classes and other names.
- Integration with Flex SDK, code hinting for MXML or other layout markup.

And small but important enhancements:
- line Numbering
- search / replace
- hints for typed Vectors

In the making
ActionScript is not the fastest thing on Earth, we don’t have background threads and there are other limitations. Still, using a few tricks, like slicing tasks to mimic threading, doing the minimum of computing right when it’s needed and caching results until new ones are available, we can build pretty powerful stuff.

Considering the programming effort that was required to build MiniBuilder, these are the
main components:

  • ScriptArea – a textarea control that can be used to do real-life code editing. It can manage 5-10,000 lines of code without becoming very slow. It features (almost) all common key and mouse combos to control cursor and selection, fast font formatting, which is a must for real-life source code. Unfortunately, due to some limitations of FlashPlayer, you cant properly insert some UTF8 chars (keyboard and paste both are affected). I’m searching for a better solution.
  • Code assist – parsers, resolvers, type database. This is the core of the project.
  • Java Applet AS3 compiler (based on asc.jar from open source Flex SDK)

MiniBuilder uses ASWing which provides a powerful pure AS3 component framework.

ActionScript MiniBuilder is released under MPL license.

There are lots of known bugs and limitations, I’m not going to list them now here, but I’ll be
happy if you fill in an issue at the google project’s page (project’s URL in Part II). Or simply add a comment here.

Depending on how much feedback the project gets, there will be more or less future inhancements,
so feel free to state your opinions, bugs, requests.

Stay put, in few days comes Part II with more details about MiniBuilder and a new example.

Any contribution to the project is welcome!

Next: Flash MiniBuilder Part II


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

31 Responses to “Flash MiniBuilder: Online AS3 IDE – Part I”

  1. [...] Flash MiniBuilder: online AS3 IDE, edit (with code assist) and compile swf online. This project, currently named ActionScript MiniBuilder , features code assist (code completion) for ActionScript 3 and compilation of one-file AS3 SWF. Read the original here: Flash MiniBuilder: Online AS3 IDE – Part I [...]

  2. Very cool. Some minor things I noticed:

    new Array(). <– produces code hints for the Array class rather than array instances. Same applies to casted values (i.e. Array(someValue). <–). Of course using “as” seems to work which was a nice surprise ;)

    The vertical scroll bar does not update after loading in a new file.

    There is no automatic horizontal scrolling while dragging (vertical is ok)

    catch() error variables are not code-hinted

    The code hint box gets cropped when it appears at the bottom of the screen. When it “closes” it also appears to just go behind the main text editor pane rather than being removed from the screen as it appears behind the editor when it closes from a low-screen open.

  3. [...] ActionScript 3 Log » Blog Archive » Flash MiniBuilder: Online AS3 … [...]

  4. Sergio Figueras Says:

    Hi!

    I’m so interested on this project. I’m a Java/Flex certified programmer from Brazil, if do you want any help it will be a pleasure for me join at the dev team.

    Thanks! :)

  5. Ahh. Sad it is modified Flex compiler. Hope some day AS3 compiler written on AS3 will be made :)

  6. oh man this is too cool. thanks for this! even without multi-file support, still very useful. gonna play with it a lot. :)

  7. [...] 更多介绍:http://www.victordramba.com/?p=31 Tags: ActionScript, IDE, tool [...]

  8. [...] Check out: http://www.victordramba.com/?p=31 [...]

  9. This is really amazing – completion works great and is pretty responsive.

    Only “little” problem (maybe related to my french keyboard): I can’t type numbers, dot, @, curly braces, square brackets, and probably some more things…

  10. @Philippe

    This is a very nasty one. Currently, the scriptarea component only works with standard US keyboard, because KeyboardEvent.charCode returns the US associated key. Haven’t decided what to do yet, but as a quick fix, we can add a few most used keyboards as maps in the application. Hope i’ll find a better solution.

  11. To me, the biggest opportunity for a flash-based IDE is collaboration.

  12. Seems like the auto-complete menu even pops up if the variable is not even defined yet. Like if you go into the first line of the constructor and write “s.” the menu will pop up.
    Also PageUp/PageDown for that menu would be helpful ;)

  13. @gencha
    that behavior is intended, check ecmascript specs. the compiler is required to move all local var and function declarations at the beginning of scope block. here, flex builder does not do it right. also, it seems to attribute scopes to blocks that do not define a scope, like if, for, while.

    page up/down and cycling through the list will be added
    and a lot other features, like help for each item
    thank you guys, it helps allot to have all the bugs, feature requirements written here

  14. This is a great resource. Thanks!

  15. @Victor
    Ah, interesting. I was not aware of that. It seems kind of counter-intuitive.

    One thing I noticed is that when you’re at the end of a line and press tab, it appends a tab. If you then press shift+tab it moves the whole line (I was expecting that only the tab would be removed). Is that intended as well?

  16. @Philippe
    i implemented a fix for the keyboard layout problem. it should work now. make sure you clear the cache, the version should say 0.0.1c
    let me know if it works ;)

    @gencha
    yes, that is how i see things. shift tab will always unindent the line(s). also flex builder does that.
    note: there’s one intended limitation of minibuilder text rendering: the tab char will always be displayed as 4 spaces, with no column alignment. it’s an important speedup.

    about var: as3 is an extension of javascript (ecmascript) and it has to follow the specs. the nice effect of this is that you can simply paste js code in as3 and (with minimal changes) it will work. if you want a language more elaborated, check haxe. or java.

  17. [...] svaka čast, a vi možete pogledati ovaj alatić i ocijeniti koliko će vam on trebati – Flash MiniBuilder. [...]

  18. Hi, finally tested it.
    Good work so far..
    I’m not getting any copy/paste function though, not sure if it’s just me. (i’m using Chrome as browser).
    My code also doesn’t run, but it runs fine on Wonderfl.
    Again, awesome work. The syntax-coloring, code-completion are superb. Keep up the good work!

  19. @John
    10x, i’m still on it

    * compiler. asc as compiler is limited. wonderfl compiles with flex api, a complete compiler. i chose asc, just a small part of flex, to be able to deliver a small jar, being a web based app.
    for the compiler i have 2 options. i’m now trying to convince asc to deal with more complex code. i’s possible, but not easy. the other option is to modify the mighty mxmlc to run all in memory. after lots of work, anyway, this will result in a jar with a minimum of 15-16M, not realy good for a web page.
    please send me the code that did not compile!

    * code completion is in work also. there are bugs and limitations. one of them is that it makes no distinction between public an protected. for the moment, only privates are not visible outside the class.
    nevertheless, minibuilder is already a tool you can use for small geometry calculus or animation tests.

    * the desktop version is the next step. that one will use flex builder and will deal with projects. swc parsing is a must. but for now, i’ll try to make this web version a bit more versatile.

    stay put, more interesting stuff to come!

  20. Wow! This is really cool. Amazing how far Flash has come.

  21. @John
    copy/paste, i didn’t notice, yes, i lost copy/paste when i did the trick to support non-us keyboard layouts
    will be fixed in next release

  22. Good and powerful!

  23. [...] Flash Creation with Flash Minibuilder [...]

  24. 100% loading but nothing happens…

  25. does not show “void” in the list of completion options after I type “:v”

  26. mack
    true. it’s comming
    this online version is absolete
    check this http://code.google.com/p/minibuilder/

  27. good job!
    severely lacking copy/past in editor

  28. copy/paste works only using the keyboard (Ctrl+C, Ctrl+V)

    be sure you also check the desktop version of MiniBuilder
    http://code.google.com/p/minibuilder/

  29. [...] no lo crean, esta persona desarrollo un MINI FlexBuilder en AIR….si, si, como suena. El tipo armó un entorno de desarrollo OpenSource que permite utilizar [...]

  30. [...] are some applications built using AsWing of which the Flash Mini Builder is an interesting [...]

Leave a Reply

Powered by WP Hashcash