Flash Blues
Friday, August 10th, 2007Work proceeds on the new Geogad web site. Some days the frustration level is pretty high, but things should be getting a little easier. Why the optimism? Because the new Flash program is more or less under control.
Flash is a very powerful and very popular way to display images, animation, audio, and video across multiple browsers and platforms. But that power comes with a cost. I am not referring to the cost of the software program. I am talking about the hair you will rip out and the remaining ones that will go white as you battle the program to get it to do what you know it should.
The heart of Flash’s power for developers is Actionscript, a scripting language somewhat like Javascript that dynamically controls the Flash movies. The main problem with Actionscript is that it feels like a kludge. For example, the last few hours I have been trying to figure out why Geogad’s Flash volume slider was working yesterday but not today. It turns out the problem is that the volume slider appears above a movieClip that is on a mask layer that is used to mask the movie on the layer below. All of this is fine and dandy and exactly what Flash and its mask layers were designed to do. Judging by depth of the movie used as the mask and the position of its masked layer, it should not interfere with the volume slider. However, it prevents the mouse from clicking on the volume slider.
The solution was to switch the masked layer to a regular layer. Then I used Actionscript to dynamically set the movieClip as a mask for the movie below (see the setMask property for more info). Now I have my mask, but it is not incorrectly grabbing mouse clicks that belong to the volume slider in the layer above.
As I said, Flash is very powerful. You need that power when you find something that does not work the way that it should, so you have to create a workaround. Luckily there seem to be multiple ways to do most things in Flash. The only problem is the days lost trying to figure out what is not working the way that it should and then figuring out another way to do it.
Technorati tags: Flash, Actionscript, masked layers, incorrectly capturing clicks, dynamic masks
