SwfMillEditor, the "break-apart"

Saturday, September 12, 2009

After prototyping a single file with XML & hscript, i started creating proper classes for the different elements of the frontend application.

Currently, most of the work revolves the source editor, which is shown in the screenshot below.

When prototyping, the source editor was a simple window with an "onLoaded" action, that placed a textfield in it, made sure to resize it when needed, and maybe had a few other lines...

That code was replaced by a single line, instead of a window, an XmlEditor class, its imported into the main application, and sits in its own file, XmlEditor.hx, as something like:

class XmlEditor extends Window {
public static var layoutXml = Xml.parse('
// here comes its xml layout...

public function highlight() {...}
public function updateTree() {...}
This allowed much better writing, with the full power of haxe driving the bigger logic and small scripts handling the smaller, this is where it left its prototyping stage, and some of its features now are:
  • Llightning-fast highlighting with regular expressions
  • Tab\Shift-Tab indentation (with visual marks too)
  • Auto-close of opened tags
  • xsltproc can be called with indent.xsl to format the source
  • XML is parsed to a tree to provide a document outline (still slow as hell though...)
  • Attributes and values of the active tag (the one which contains the caret) are displayed in a list.

Second screenshot, shows the FileDialog class, tree is filled with directories, and the lists are filled with files and their stats, all data arrives via the neko backend, this should make it simpler to browse virtual filesystems too, like those that actually sit inside a remote database or in memory...

Checkout the shots below, and stay tuned for more, gershon.

P.S: sorry for the mis-spell on the note in the first screenshot, too late&lazy to fix it ;)

haxegui Ohloh page

Sunday, September 6, 2009

Spawned by a webcraweler, https://www.ohloh.net/p/haxegui, is a nice page, somewhere between this overly-flash-embedded blog and the plain googlecode page... Its statistics complain, as i have before, that
Over the past twelve months, only 3 developers contributed new code to haxegui, making this a relatively small project.
Well, by no means can the codebase be considered small, and its getting bigger, approximately 20k of haxe code, with about 500k more backing it up in XML data and HTML docs, Considering its capabilities, that ain't bad at all... Please consider using, contributing, asking and commenting, here, on the new ohloh page, on the haxe mailing-list or in #haxe on irc, your support can mean a lot, a good comment's worth 1k line of code ;) In an effort to enlarge the number code contributers, i have been writing more text, the GC wiki has a number of tutorials on some basic haxegui components, soon i'll start writing task-specific tutorials ("real world" practical examples, custom components, skinning tutorials...) Off to do some coding....

Step Sequencer Demo

Saturday, August 29, 2009

Another sample of the great look and power of the haxegui framework, this time, a step sequencer for flash9 in under 500 lines, still WIP, and requires some fixing and optimizing. Has been hacked up over the weekend, uses mp3 samples, has a nice FFT spectrum, individual channel volume and pan, no note velocities and patterns yet sorry...

The code is on svn as usual (single file, samples/Example4.xml), no "haxe" has been used when writing this, just XML and hscript, on top of the usual haxegui application skeleton. This means there was very little compilation to do while writing this, still the app takes a few seconds to boot, so please be patient.

I would love feedback on this post, but hate it if it came from my stereo... ;)

Prototyping the SwfMill Editor

Friday, August 14, 2009

Its been a great companion, and i just love it. How can you not love a program that takes 'simple' as an argument?

For me its been the simplest, whether i compile with MTASC and inject the logic into a swf containing assets linked to as2 classes, or add assets into haXe made swfs compiled to as3.

Its a small and wonderful tool, that integrated well into my workflow, saving me not only time, but also from the jaws of proprietary software...

But for a while now, i've been toying around with the thought of making it even simpler using a frontend. The screenshoot below shows that thought transformed to working code, you can see the application editing the very same files that have been embedded when creating it.

The details of what it does, and does'nt yet, are already annotated in the screenshot, i'll just add a word or two about its prototyping process. It took only a couple of hours to generate this little app, some of which involved fixing stuff in the framework, which takes longer and requires compilation in haxe, layouting and simple events are done in xml and only require a browser refresh. Other than the haxegui package, there are 3 files involved. First one is a xml file for the layout and some simple events, second is a hx file that is compiled to a flash9 target, it has a single class and static main function, it initializes haxegui, loads the layout and works the logic, like parsing xml and setting up event listeners. The 3rd file is also a single class hx, it compiles to neko, and is a server for files and for swfmill input and output. The whole thing is run in two stages, first i run a local neko daemon, using 'nekotools server', then i navigate to the server address to land in a 'index.html' page which embeds the swf.

No paid software, knowledge or service has been used to write, run and bring you this, i would love to have your ideas and comments on this one, a working demo and the code should be released soon...

Small online tutorial

Wednesday, August 12, 2009

Here's a little interactive tutorial, the black window in swf below is the Console class, its got one textfield which traces results, and another (the lighter, single-line input at the bottom) which parses hscript. Type the following code in the console, type 'help' to see a list of other commands:
new haxegui.Window().init();
// window name might vary here, can type 'ls' to make sure
cd Window19
// following is written in a single line to preserve the scope
var c = new haxegui.containers.Container(this); c.init();
// following also might differ at runtime
cd Container29
var tf = new flash.text.TextField(); this.addChild(tf);
this.firstChild().text="hello world"
ok now for something more fun:
cd ..
// should be back in root.Window19
this.updatePositionTween(new feffects.Tween(0,1,1000), new flash.geom.Point(200,200))

Here's a screencast of me following the tutorial, then loading an example layout from the svn and playing with it a little, please excuse the jittery mouse tracking...

jEdit and haXe

Thursday, August 6, 2009

For a while now, i've been using GtkSourceView-based applications for writing (Geany&Gedit), but decided to move back to the old trusty friend. I must admit that i'm a newbie to java, my previous uses for jEdit were mainly as2 and php, this time its haxe and java.

There's a haxe mode for jEdit here, which does the highlighting, my intention is to write a proper haxe plugin for jedit, one which will install the mode above, add a haxe menu for easy access, options dialog for configuring general haxe stuff like paths, classpaths and the likes, sidekick integration, project integration, text completion, import tools and documentaion launchers.

I have'nt much thus far, but i'd like to share what i do.

Installing the console & errorlist plugins, you get a single click reference to the line on compilation error, and works for haxe\ant(i'm using anthx)\make\swfmill.

Installing the sidekick plugin, outline plugin, ctags plugin, and custom folds, will get you a couple of nice views on the sidebar.

So for a typical function that looks like this:

//{{{ doSomething
/** This function does something **/
public function doSomething() : Void {

I get 2 folds, one for the expilict fold (line #1), which opens up the comment and the function header, the second opens the function's body (#3). If 2 clicks seem much to get to the body, not to worry, keyboard shortcuts are a-plenty in jEdit, alt-enter and alt-bs will collapse and expand folds...

This needs a lot of cleanup, but basically works for the ctags plugins (place this at ~/.ctags on linux):


--regex-haxe=/^[ \t]*[import ]+[ \t]+([A-Za-z0-9_.]+)[ \t]*/\1 /F,import, imports/
--regex-haxe=/^[ \t]*[(enum) ( \t)]+ [ \t]+([A-Za-z0-9_.]+)[ \t]*\(/\1 /e,enum, enumerators/
--regex-haxe=/^[ \t]*[(typedef) ( \t)]+ [ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1 /t,typedef, typedefs/
--regex-haXe=/^[ \t]*(private|public|static|inline) *[ \t]+var[ \t]+([A-Za-z0-9_]+)[ \t]*/\2 : \1/v,variable, variables/
--regex-haXe=/^[ \t]*(private|public|static|override) *[ \t]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\(+([A-Za-z0-9_]+)*\)*/\1 \2 (\3)/f,function, functions/
--regex-haXe=/^[ \t]*[(class|interface) ( \t)]+([A-Za-z0-9_]+)+([ \t]?)(extends|implements)[ \t]+([A-Za-z0-9_]+)+[ \t]*/\1 \2 /c,class, classes/

The project viewer, buffer tabs, tasklist, svn, jdiff (uses the built-in splitting), whitespace, textautocomplete and textutils plugins are also great and must have.

Even with all these plugins loaded, the editor is very light compared to its java friends (eclipse and netbeans) both in size and resource usage.

Here are a couple of screenshots, to stop me yapping. have a great day!

Call for devs

Wednesday, August 5, 2009

About a month has past since the birth of this blog, 2 for the googlecode repository, and total of 3 for the whole project.

Since its my opinion that no self-respecting developer should put up a project like this online, without utilizing all of the resources available to him, i've been tracking these pages with analytics.

The score is 800 to 2, there's support, i'll grant that. A couple of devs on the mailing-list, and a few around #haxe, but in the code you'll still find only two names.

So this is a call to anyone doing anything gui-oriented in haxe, to chip in.

How about this for an interesting challenge, haxegui on the iphone via haxe cpp and nme\neash?

Some haxegui applications? an icon editor, map editor for tile-based games, sprite sheet editor with bitmap, swf and swfmill input\output, mp3 sample editor for trimming and looping, pattern & multi-track sequencers, image orgranisers, chat and im clients...

Or how about a haxe ide in haxe? regexing and highlighting, with dot completion, the hscript console, system shell, and a haxegui builder?

Hmm... ok, so seems like anyone doing anything haxe is welcome ;)

See you around, gershon.