What The Hell, Flash? Ep 2: When frame action gets inherited

Here we go again.

My work flow of doing Flash animation is to tween stuff in a MovieClip and use labels + gotoAndPlay() calls to switch between animations. Nowadays, with the switch to AS3, most of the animation controls are done via external script files, so the MovieClips in my library are now mostly devoid of any frame based actionscript (a very old leftover technique from like the Flash 4 days)… except that I still use frame actions for very simple looping calls (gotoAndPlay(“anim1”) at the last frame of the anim1 animation frames, for example).

I guess the title of this post is a pretty big spoiler, but I’m surprised I didn’t encounter this problem until now. Usually if a series of animations shares the same animation control scripts (say, guy1, guy2, and guy3 all have different animations but are handled the same way), I’d have a common class that the animations would inherit from (Guy1 extends GuyAnim, Guy2 extends GuyAnim, etc). Only this time, I got lazy… I have a few animations inheriting from the first of its archetype, which contains all the control scripts (so Guy2 now extends Guy1, and Guy3 also extends Guy1…)

Imagine my surprise when the animations start glitching like no tomorrow. I guess getting a strange “invalid function override” warning when I place frame scripts on certain frames should have warned me to something, but it’s just one of those quirky things where intention don’t match behavior. I have two timelines with one set of animations in one clip and another set of animations in another clip. I have two script files (that doesn’t contain any of the frame script) where one inherits the other. In appearance, nothing overlaps, but somehow the frame scripts are probably attached to the class objects during compile time, and the result is a total animation glitchy mess.

There are times when actionscript can accommodate the strangest, anachronistic workflows between multiple versions of Flash and still somehow make it all work. Then other times… well, this happens. Oh Flash, how I learned to hate to love you.

Rant Tuesday: It’s Still Like This Ten Years Later?

Okay, so work is hard.

Modern webdev is also hard. Madness, even. You’d think that coming back after 10 years the whole HTML5 thing would be a bit more civilized… after all, the last time I touched JavaScript was when Flash was in version 4, when you had to cobble together code through drop down menus. It was horrible either way.

Ten years later, Flash is now a somewhat respectable coding environment, even if some of its quirks and slowness never went away, but javascript… it looks like nobody bothered to clean the lawn and everyone kept piling on trash, and there’s people pitching tents around themselves like jQuery and they keep pretending the entire coding environment is anything but a steaming pile of manure.

There’s no avoiding it though – Flash is going away. Less than five years from now there’d be more people using dedicated content consumption devices than content creation devices, and nobody is hedging their bets that Microsoft is going to pull through with the likes of Windows 8. So HTML5 is as close to the new “build once deploy everywhere” environment as you can get.

Meanwhile, I’ve found half a dozen ways to write a helper class to load a bunch of images, with none of them looking either right or wrong.

This transition is going to take quite a while.

HTML5 Tuesday: Zoom!

I’ve been meaning to learn HTML5 for quite a while, perhaps even longer than the time I’ve been meaning to pick up drawing webcomics and messing around with music composition. Problem is, I’ve been using Flash for so long, and javascript is dumb and suck… and dumb.

But there’s no avoiding it, so I’ve written a little something… let’s hope that it actually works (on anywhere but my home browser):

Zoom!

Nothing complicated of course, just a little image being zoomed and reset every few seconds. The code is super primitive – eventually I’ll need to learn to code up some properly image loading, image rendering, and other miscellaneous functionality into separate javascript files.
 
Dropbox seems to work for me after some initial setup trouble, but I suppose I’d need to shop for a web host now…

Dream Journal: Rules for Time Travelling

If anyone ever bother to read far enough back, this blog used to be a dream journal before I’ve decided to use the space to practice my craft. I’ve deleted most of the uninteresting or too personal posts, but once every blue moon there’s still dreams that are interesting enough in and of itself that I want to write things down.

This is definitely one of them.

The dream itself might have been all over the place, but the rules for time travelling is pretty explicit:

  1. You can only travel back in time, never forward.
  2. A time traveler can, at any moment in time, produce a time ticket. A machine owned by the time traveler can remotely print them.
  3. The time ticket looks like a movie/concert ticket, recording the time and location the ticket was created.
  4. Once retrieved from the machine that prints the ticket, it can be used any time by reciting lines printed on the ticket and tearing it. Holding on to the stub, the time traveler instantly returns to the moment in time the ticket was produced. Everything is the same except that the time traveler maintains all memories before making the trip.
That’s pretty much it. It’s not particularly scientific or unique, but the idea of the moments saved being tickets have a particularly interesting ring to it. I can probably write a short story this coming Tuesday based on the idea.

DIY Tuesday: $2.99 Dice Tray

Dice Trays. They’re certainly a luxury for board gamers, and a simple search on amazon says a run of the mill dice tray is going to cost you like $20 or more. Well, screw that, that’s too rich for me. I mean, there’s certainly cheaper solutions out there, and that brings us to:

This lovely $3 Dice Tray, with bonus dry erase surface!

All you need is an IKEA RIBBA frame (pick your color!) for $1.99 and a cheap dry erase board combo thing from Staples for $1. You don’t really have to get the dry erase board, but I like the bottom of the tray to have a slightly softer surface and I’m used to the sound of dice hitting cardboard from tossing dice into board game boxes. The softness of that cardboard feels just right.

The instructions are dead simple: disassemble the picture frame. Use the paper with the bar code to measure out the size of the frame on the cardboard.

Use scissors to cut around the cardboard. Remove the magnet from the back of the board and reveal the stick side of the tape. Flip that paper with the barcode over and tape it onto the cardboard to cover the ugliness. Reassemble the frame with plexiglass at the bottom and the dry erase board on top. Originally the dry erase board would be the drawing surface on the other end, but somehow the plexiglass actually leaves fewer marks when it’s being erased. Tape the dry erase marker’s velcro sticker to the frame’s side, and you’re done!

To use the dry erase side, flip the tray over. Not only do you get a (mostly) practical dice tray, you get a dry erase board for writing down score and stuff for free!
Sensible people would probably try to pimp this up by lining a felt surface on top and inserting softer foam (mouse pad foam) at the bottom, but it does kind of defeat the cheap and dirty spirit of this dice tray. You can also try one of the larger RIBBA frames, but the cost kind of scales up in an unpleasant way also. And if it turns out that the dice tray is pretty useless… I’ll get back to you on that.
Time for some Elder Sign.

I blame the heat

I really do. now I can actually start doing something other than lounging around and complaining about the heat…

Belated Rant Tuesday: The Case for Solitaire Board Games

Blarg, late again, but I’m late this time because of this:

I’ve beat an AI character, one that operates on cards and written rules instead of some smartphone app or Flash program or Steam app. It’s as old fashioned as it can be, and yet… something about it feels good. Like, better than computer games. It’s absurd, I know. Here’s what I’ve thought up so far that’d justify this far-fetched idea:

  1. Physical feels good. It’s the same advantage that you get with normal board games. Holding and moving a pawn, slamming down cards… all these can be easily (and maybe better) simulated on the computer but you just don’t get the tactile feel of manipulating stuff.
  2. More physical space means more information. With screen real estates plateauing at 1080p and actually shrinking for new laptop consumers (what is this 1336×768 nonsense), having physical space to “display” information actually makes information feel more handy. That discard pile to the right? At this size, it’s probably easier for me to just dive through actual cards rather than some sort of on screen search interface – this is especially true if the cards are MtG style unique cards.
  3. There are just some things the human brain can compute easier. Special abilities are a pain in the neck to program, but all it takes are a couple of well written words for a human to compute all the interactions. Which usually means with designer board games, you get a lot more text heavy special abilities. That’s a good thing. It’s variety that you don’t normally see in computer games.
… and once in a blue moon, I’d pull out a deck of cards to play (Klondike) solitaire. Blasphemy, I know.

What The Hell, Flash? Ep 1: When String is an Integer, all hell broke loose

There are times when Flash is amazing to you. Things that you thought it’s going to screw up, the interpreter would compensate and everything works better than you imagined. Then there’s time when one wrong turn and the whole damn thing explodes.

I’ve been working with Adobe Flash since Flash 4, back when it was called Macromedia Flash. Every iteration since 4 has had its perks and quirks – and as a Flash dev, you learn to live with all of its idiosyncrasies and work around stuff that’s actually broken.
One of the many regrets that I have over the past 10 years is that I have not been documenting all the quirky broken stuff that happens with flash – things that I tend to forget after a while and come back to bite me later. Today, I present to you this gem:
Alright, I admit that I was being lazy – I used FlashDevelop’s code generation to create the constant, which automatically declares it as a string with the same name as the variable. I didn’t quite erase the type definition far enough and after wrapping up other sections of the code, I compile and run and…
Blank screen.
I wondered if there’s some problems with my resource loading – so I put some debug traces in the document class, compile… blank screen.
Okay, this is getting stupid. I try to launch the file in Flash’s debug mode, and it says “you cannot debug this swf because it does not contain actionscript”. Right. A few thousand lines of code, they just all conveniently disappeared. The source files are all there, the linkages are there, Flash just refuses to recognize I’m publishing a file that contains any code at all.
Alright, panic time, I pulled out the most recent backup of the project, retrace the changes line by line… and finally, I found this little gem that should have been caught as an innocent syntax error. Well, that’s a whole day wasted, whoop-dee-doo.
Lesson of the day: Don’t assign types to constants. It’ll destroy ActionScript’s space-time continuum apparently.

Missing Two Deadlines in a Row

I’ve missed Art Friday from schedule issues, and family matters came up in the last minute that’d prevent me from posting Design Diary Monday on time (I’ll still get it up in the next hour or two, though). The blog-a-day schedule is not as stable as I want it to be since I have not been able to (or had the motivation) to build a back log, even though that was my intention from the beginning…

And I just thought I’d link this up with my g+ since I’ve just read about that today! Not exactly the best face to show after a month of (mostly) consistent day-a-blogging.

Oh well, there would be a burst of contents, since I’ll be doing my design post, a make up art post, and a rant post all in a matter of hours. Well, the art post would come even later, actually…

Rant Tuesday: I Don’t Want to Rant about Dark Knight Rises or the Shooting

…but apparently I can’t put anything else in my mind at the moment, so I’m stuck with these ideas.

The movie was fine. It was… good, I guess? It certainly didn’t leave an impression like The Avengers did, or Inception, if we’re talking about a movie in Nolan-verse. I think the movie worked up until the Lazarus Pit sequence… everything was logically hopeless up to that point. And then the writers realized they’ve written themselves into a corner and things started to unwind in increasingly comical manner, until the ending when it pretty much ended up like this:

(I still can’t believe none of the friends with me got the reference when I mentioned it)

…and the shooting that’ll forever be associated with this movie. Whenever inhuman tragedies like this happens, I really wish there’s a way to erase the identity of whoever is responsible… not for their sake, but so that their names would never be recorded anywhere in history… in a generation where every voice wants to be heard but few would be heard, I find that rewarding these extreme acts of depravity would fast become a dangerous slippery slope.

…on the other hand, I find it extremely difficult to sympathize with the victims and those related to the victims of these events. I’m suppose to feel sad, I think, but I don’t know any of these people, just a name and a vague description. I know how I’m suppose to feel, but whatever feeling I have is not going to be genuine. And when am I – when can I – be happy again?