Flash Frustrations

So in a recent project, I came across 4 Flash frustrations, or “Flashtrations” as I am starting to call them. These are basically bugs in Flash that are so annoying to a developer like me that it drives me mad. Here they are:

1. getURL and POST. Yes, I know that posting via getURL doesn’t work while testing. That’s at least a documented frustration. But it also doesn’t seem to work when in the browser. Well, it doesn’t work often enough, at least. I charted about a 10% failure rate. 90% of the time, the POST variables reached the server OK. 10% of the time they didn’t reach the server at all. It wasn’t about browsers, versions of Flash or firewalls, either. The same user would post fine several times, and then all of a sudden their post would be missing the variables. The solution was to go to a sendAndLoad LoadVars command, then get the result back, then do a getURL without any variables at all to complete the process. Three times as much work for me and the server.

2. Reseting movie clips. In Flash there is no good way to bring a movie clip back to it’s original state. Say, for instance, you have a movie clip that generates a bunch of internal movie clips to simulate a pull-down menu. That works great. Then, when the user makes his or her choice from the menu, it should remove all of those temporary movie clips to return the main clip to it’s original state. This often works OK, but not all the time. In my case, it worked the first time, but never again. Specifically, removeMovieClip failed to work, as well as the alternative unloadMovie. Levels set OK, debugging confirmed everything being executed OK, tried  hundred ways to do it. Flash just plain fails to remove the movie clips for some reason.

3. LoadMovie creates crippled movie clips. When you fill a movie clip with an external .swf, you can’t use duplicateMovieClip to make copies of it. The reason you would want to do this is so you can load external game pieces. For instance, say you made a chess game, but you wanted the chess pieces stored externally. So you had a chesspieces.swf that an artist could mess with. Each frame was a different piece. You would need to load the .swf 32 times to fill the chess board. You couldn’t just load it once and then duplicateMovieClip. The work-around is to create a board.swf externally that had a blank timeline and a chesspieces movie clip in it’s library. Then you could load the entire board.swf movie clip into a movie clip on the stage, and attachMovie inside that movie clip all you want. But you would never be able to place main timeline elements between the clips in board.swf. Plus, the external .swf is that much messier and hard to explain to artists.

4. Components are huge. Well, this isn’t a bug, but it is a frustration. I’ve spent my whole Flash/Shockwave career finding ways to save an extra K here and there on file size. I know some developers don’t care, but I do. You save on server bandwidth, and you save the user download time. So, my recent project was 20K. It just didn’t have that much in the way of graphics, it was mostly script. But I wanted to add a simple drop-down menu to it. The component would have been nice, but it clocked in at 50K! So I would have to go from 20K to 70K just to offer the user a drop-down menu choice. No thanks. I wrote my own drop-down in less than 1K. Of course, I had to deal with number 2 above.

December 20, 2006 • Posted in: General

7 Responses to “Flash Frustrations”

  1. Keith Peters - December 20, 2006

    Beyond the first one, which I haven’t really run into myself, and maybe aspects of components, I wouldn’t call these bugs. I’ve never had a problem removing movie clips as long as the depth was in range (simply having v2 components in your library can mess this up though). Load movie works the way it works. It may not be the way you want it to work, but that’s how it has always worked. I don’t get frustrated with my dishwasher because it doesn’t cook my dinner. I just use the oven. By the way, check out AS3, which has handled many of these issues.

    On the v2 components, though, I feel your pain. Large, buggy, impossible to skin. Luckily, Adobe has heard our cries and promises a much better set in Flash 9.

  2. Ben - December 20, 2006

    Regarding number 2, I’ve never had removeMovieClip fail for no good reason, but I did take a slightly different approach. Even if removeMovieClip works perfectly, its much simpler if you create all of your sub-clips in a single mc. So you create an empty mc called menuHolder or whatever, build your menu in there, and then to kill it you just remove menuHolder.

    I agree #3 is frustrating, but am not sure why you’d take the one-symbol-per-frame approach. Symbols attached from the library seems much more straightforward and conventional.

    #4 I definitely agree- its pretty much a global consensus that the components in past versions were sub-par. Hopefully that is all changing in F9 thanks to gskinner and metaliq.

  3. MrSteel - December 20, 2006

    seems to me you should learn better AS programming
    I am just saying this, not wanting to be rude, but to point you that you have same approach to criticize Flash… there is far worse thing than big component size in kbytes but it’s important (it depends more on graphics you put in component then from compiler), about loadmovie I must say, I’m not using it for loading SWF
    other stuff never happened to me, so I can’t say if it’s a bug or it’s just human error

  4. Gary Rosenzweig - December 20, 2006

    Some replies:

    MrSteel: That is kinda rude, actually. I consider myself a damn good AS programmer. I’m guessing that you just haven’t run into these things. Heck, I didn’t run into them until this month. And what is wrong with criticizing Flash? Isn’t that what I SHOULD be blogging about?

    Keith: I disagree about the dishwasher thing. duplicateMovieClip duplicates a movie clip. But it doesn’t duplicate a movie clip if it happens to have been loaded via loadMovie. Why not? A movie clip should be a movie clip. And in this case, duplicateMovieClip would be very useful. I’m glad to hear that AS 3 is fixing these issues.

    Ben: A one symbol-per frame movie clip is far easier to work with. Say you have a mc with 52 playing cards. They each share a border and background, and have different face elements. It is easy to flip between each frame and see/edit all 52 cards. But if they were in 52 different symbols, then it takes much longer. Suppose you wanted to add an element, like a border, to all 52 cards? Hard to do across 52 symbols, easy to do across 52 frames in one symbol.

  5. Ben - December 20, 2006

    If several symbols need to share the same background, border, etc then make that a separate mc and put it in each other mc, either by hand or programmatically. Or draw the shape programmatically. Either way, using frames to simulate multiple movie clips is a non-standard approach and as a result I don’t think you should be surprised its not easy to accomplish.

  6. Algis - December 20, 2006

    About number 3. Have you tried extending MovieClip class ? It usually helps me a lot when working with many movie clips that share same properties ant methods.

  7. Rob - December 20, 2006

    Hey guys just want to comment on “Flash Frustrations” #2.
    To alleviate a failed removeMovieClip, I would use:
    setTimeout(this, “removeMovieClip”, 1);
    Why it works rather than “this.removeMovieClip”, I am not to sure about.
    It could be because the Flash VM has an instance of the said movieClip somewhere. Saying setTimeout as the last command of a cleanup method gives control back to the Flash VM so the garbage collection can happen.

    I could be wrong, any thoughts?

Leave a Reply