Walking With Flash
March 10th, 2008In my day job, I’m a computer programmer. I work in the games industry, doing AI and animation work. I’ve worked on titles that that are sitting on store shelves nationwide. I have a Master’s degree in computer science. Given all this, I thought that I’d be able to jump right into this flash programming thing with no problems.
Well, not quite. This took me pretty much all freaking afternoon:
(use the arrow keys to walk back and forth)
I think that my biggest problem is that I know how to do things the right way. My first thoughts when making this demo were to set up a data-driven animation state graph with scripted transitions and root translations streamed in from the source art. As far as I can tell, that’s just not how things are done in flash. In fact, most of the actionscript tutorials out there look like they were written by people going out of their way to do things the wrong way. Global variables? Sure! Hard coded values? Why not?! Variables made up on the fly? Of course!!
At least actionscript 3 looks like it allows you to add a bit more structure to your program ![]()



March 10th, 2008 at 5:06 pm
Yeah, I started with flash, and after learning other programming languages, it seems like it is more chaotic than others. Most of flash is just sticking it all together, gluing some parts on, then if you get no errors, its ready to ship. In my opinion, flash is too loose, and you can deviate from good structure too often.
After learning other things then coming back to flash, it looks to me like flash programming is run mostly by functions, while those and the rest of your code sitting on the root frame.
Keep in mind that my programming experience Isn’t almighty, and I am self-taught in flash, but I’ve been doing it for a while.
March 10th, 2008 at 5:17 pm
If only he could jump the I could play this all day, the animation is delightfully smooth.
March 10th, 2008 at 5:39 pm
Needs to loop. (See Pac-Man for further details.)
March 10th, 2008 at 6:10 pm
But if it looped, he’d be able to see the back of his own head, and it would drive him mad.
March 10th, 2008 at 6:37 pm
If they knew how to program things the right way, they would be working on actual projects for actual money rather than writing free actionscript tutorials for web sites.
March 10th, 2008 at 6:50 pm
People often make the mistake of think that Flash ActionScript was made for programmers when quite the opposite is true. It was originally designed to allow people with very little programming knowledge make interfaces for an OS that was never made and was then sold to Macro Media who tweeked so Artist could jump in and use it without too many issues. How would you accomplish this? by removing as much structure as possible so you can add things as you think of them, rather than design something ahead of time.
It’s fun to play in once you realize a few things are upside down,and once you figure out what the designers were thinking, it’s actually easier to think in than 3.0 (which isn’t really actionscript).
March 10th, 2008 at 7:49 pm
He needs a distance indicator so I can see how far off-screen he is.
That way, if I angle my screen properly. I can get him to fetch me a drink from the fridge.
- RG>
March 10th, 2008 at 10:56 pm
Flash can be a bit counter-intuitive to people who come from a development background, its built for people who come from a design or art background; it lets you add things on the fly and holds to less far fewer structural standards,
This can be great in some cases but tends to make code heavy projects get a bit out of hand in terms of good practice, especially since there are usually multiple accepted ways of doing anything and everything in actionscript.
However having said that, once you get used to it, it can be quite fun to do just do whatever and stuff good practice now and again, plus its much faster to develop web applications then pretty much anything else, even if you do sometimes (read: often) sacrifice execution speed you make up for it in development time and ease of distribution.
March 10th, 2008 at 10:57 pm
There’s something making you feel good when you can control people with keyboard arrows… ;-]
March 11th, 2008 at 1:44 am
I had much the same experience with Flash. I’ve gotten a degree, several years experience, and even a good handle on how to do the whole vector/fireworks design side. However, Flash is so counter intuitive and backwards that I gave up on it and went back to real compilers in an effort not to waste away my life fighting with a product that was never really designed for real coders to use.
March 11th, 2008 at 3:33 am
I tried SHIFT, CTRL, ALT and but I still can’t make him jump. What am I doing wrong?
p.s. awesome.
March 11th, 2008 at 6:13 am
I don’t think you’re doing anything wrong. Look at him, he’s not a jumping kind of guy.
March 11th, 2008 at 9:42 am
No idea how relevant this is, and I’m probably just being a nitpicky jerk (I’m a lawyer, I’ve been trained for many years to be a nitpicky jerk, so if that’s the case, then I sincerely apologize) but his body moves forward at the wrong part of the animation. The torso and back leg just pop forward as soon as the leading knee is raised, rather than in the mid-part of the step. Very smooth, though. Reminds me of Commander Keen. Maybe Commander Keen’s dad, Capt. Fred Keen, USAF (Ret.), who is now a Social Studies teacher or something.
March 11th, 2008 at 10:33 am
Mr. SCP guy (I don’t know what your name is even though I’ve been reading your comic for a long time!), I have the exact same problem with Flash (also having an MSCS and being a Real Software Engineer by day, and I also have a few shipping games under my belt although I’m no longer in the games industry).
It’s not ActionScript to blame per se, since you can easily do things the right way in other ECMAScript variants (for example, http://beesbuzz.biz/error/403.html does some stateful animation in JavaScript), but there’s some pervasive ad-hoc principles at work in Flash. The same applies to using it to do animations as well; for music and video editing I’m used to apps like Logic and Final Cut Pro which let you easily arrange things on a timeline and apply simple transformations to them in a structured manner, and then whenever I try doing anything in Flash I just feel totally lost, and like Flash structures things in exactly the opposite way from how they should be. Then I see how so many pretty good-looking animations are always being posted on NewGrounds et al and I’m all WTF but then I see that most of the animators are either 14 years old or have been doing it professionally for years and so I don’t feel so bad (since obviously they have more time to dedicate to it than I do).
But still, yeah, Flash is basically a big pile of mediocre stuff combined in ways that seem to work well for the unorganized masses but sucks for people who actually approach a problem from a principled standpoint.
March 11th, 2008 at 10:35 am
He’s actually moving forward at a constant rate (governed by actionscript). This is not an ideal solution - the motion of the sprite should be governed by the animation itself - but I haven’t been able to figure out a good way of doing that yet. If I were working in a “real” framework, I’d export offsets for each frame of the animation, and then interpolate between those as the thing plays. I’m not sure how to translate that into flash, however.
They guy is actually a couple of nested movie clips. The main one has one frame per animation, and the sub-movies on each frame hold the specific animations. I have a simple state machine running on a subclass of the main guy clip which calls specific animations by calling gotoandstop on the various frames. If I could track the offsets of the pivot point in the underlying animations, I could accumulate that back up to the main clip and the motion would look much better. Does anyone have any ideas on how to do that?
Also, is it common practice to work in frames for a set clip frame rate? I’m used to working abstractly in seconds and intervals, and then rendering down to a specific framerate at run-time. Tying yourself to a specific frame rate seems. . .yucky
March 11th, 2008 at 10:42 am
“Mr. SCP guy” being Kevin I guess? Okay then.
March 11th, 2008 at 10:42 am
As far as I can tell, the only thing that flash has going for it (from a software engineer’s perspective) is the ease of deployment (and sandboxing, I guess). I think that a skilled programmer would be just as productive in C++ with a well-designed framework. Hell, you could even use C# or Python or something higher-level like that if you want to be
sloppyproductive.I guess there’s always java. I haven’t used it in years - do applets have hardware-accelerated graphics yet? I could live without scaling and rotation - you can make a killer game with just a nice, fast, alpha blit.
March 11th, 2008 at 10:48 am
I believe Java3D is available to J2SE applets.
March 11th, 2008 at 10:05 pm
to Kevin: as a matter of fact one of the biggest complaints i have about flash is that the frame rate is set at authoring time.
You can get data about how much time has passed (in milliseconds) since the swf started running or time (again in milliseconds) since some seemingly arbitrary point in time in 1972.
This is incredibly annoying, and ive yet to see anything close to a comprehensive fix, abode MAY have done something about it in AS3 but somehow i doubt it.