Archive for the ‘Spark’ tag
AS3TextArea – simple AS3 syntax coloring Flex/Spark component
Last week I released the as3term project, which is a simple AS3 Terminal application. This week as part of my work on as3term 2.0 I’m publishing this simple AS3 syntax coloring Flex/Spark component. Actually I was inspired by my colleague Anirudh Sasikumar and his powerful as3syntaxhighlight library. My initial thought was to use the library, but for as3term I needed something really simple, so I thought that I would write it myself using a few RegExp statements ;)
This component can be used to colorize source code of other programing languages. I defined multiple types of language keywords that should be recognized and styled. For each type you can specify your own styling as well.
- .default styles all keywords that don’t have style specified
- .text styles non-keyword text
- .var exceptional var styling
- .function exceptional function styling
- .strings exceptional string styling
- .asDocComment multiline comments /** comment **/
- .comment single and multiline comments: /* comment */ and // comment
- .accessModifiers styles: public, private, protected, internal
- .classMethodVariableModifiers styles: class, const, extends, final, function, get, dynamic, implements, interface, native, new, set, static
- .flowControl styles: break, case, continue, default, do, else, for, for\ each, if, is, label, typeof, return, switch, while, in
- .errorHandling styles: catch, finally, throw, try
- .packageControl styles: import, package
- .variableKeywords styles: super, this, var
- .returnTypeKeyword styles: void
- .namespaces styles: default xml namespace, namespace, use namespace
- .literals styles: null, true, false
- .primitives styles: Boolean, int, Number, String, uint
Below is a demo application that actually colors the syntax of its own logic. You can also checkout the source code over here.
UPDATE 09.09.2010 – I submitted the source code to the github.
You can paste or type in your own AS3 code into it and it will do coloring as you type.
And this is how as3term will look very soon:


