Don't you hate when you do a bunch of work doing one thing and then think of such a cooler way to do it, except now it would be dumb to do it that way?
See, I have these multipage forms I have to make. I made one a few weeks ago, and it is really fragile, but it works fine. Now I have to make a few more smaller multipage forms. All day, I've been paging through ActionScript: The Definitive Guide1 So, I finally figure out how to make classes2 in AS and read a bunch about the Drawing API. So, now I'm considering how cool it would be to make a set of classes that can generate a multipage form given just an XML file3. Of course, to write this correctly, I would've needed to start much earlier on this.
Maybe I'll just write it after I finish up this project. Then I can be a good contributing citizen and release the source without getting in trouble. :-P
Of course, probably sometime between now and then I'll start hating ActionScript again. It's really easy to hate. :) At least as I read through this book, I'm finding about some of the gotchas before running into them in the real world. 4
Isn't it great that posts like these are the ones I generally find most interesting to read and write, yet only a handful of people reading will know what the heck I'm talking about? :-P Or, that my footnotes are roughly the same size as the main text of the post. :-P
1. I say paging and not reading because I was more skimming than reading in depth. The book, unfortunately, assumes no programming experience. I wonder how many books I have which explains exactly what an if statement is by now. Surely, there has to be a market for people who want something more approachable than a manpage, but already knows why local variables are a good thing. :-P
2. When I first saw how Perl added OOP, I thought it was the lamest hack in the world. I stand corrected. ActionScript's way of doing it is lamer. Turning a hash into a magic black box is one thing. Turning a function reference into a magic black box is just crazy. It works because functions, like everything else in ECMAScript,
3. No, I'm not one of those big XML advocates who thinks that XML is the be all and end all of everything. XML is just a file format and has strengths and weaknesses, just like every other. However, Flash has builtin hooks for XML Parsing and it's builtin String methods are not too rich. The parser would undoubably be easier to use and will be faster than whatever parser I could write in ActionScript for my homebrewed file format. XML is just the easiest thing to deal with in Flash. If I were writing this in Perl, I would be writing the configs in.. um.. Perl. ;) I love fully functional eval(). :-P
4. Like, did you know that AS's eval() can do very little? Pretty much all it can do is emulate arrays. This was from Flash 4 or so before arrays were part of the language.