Flash Perlin Texture Components: Wood and Marble

A while back, I wrote about rendering Wood and Marble using Perlin noise. But I've found that these code bits are a pain to use. You need to write code just to see them. You can't work with them in the Flash IDE; i.e. they are inconvenient.

Solution: package them in components with live preview. That way you can see them, adjust their color visually, mask them, drop shadow them, etc.

So, here they are.

   WoodTexure.zip or WoodTexure.mxp

Note that these are MovieClip-based components, not UIComponent-based components. They have no events, don't need keyboard focus or anything like that. Therefore, they don't weigh much -- about 3K - 5K.

Of course, these require Flash 8 -- they use Perlin noise.

I really like the idea of texture components. Usually, Flash components are UI widgets or data connectors. Well, why not design elements?

Obviously, you can use bitmaps instead. What you get with components, however, is:

  • Alter parameters to customize the look.
  • Tiling not necessary.
  • Smaller download (maybe).
  • Animated textures are possible.

Instructions:

Let's say you want to make a Scrabble™ tile. You will want to bevel and drop-shadow your wood-texture square. Unfortunately, The Flash IDE does not let you apply filters to components. All you have to do is embed the component in a movieclip, then apply the filters to that movieclip.

If you want rounded corners on your tile, you will need to mask it. If you apply the mask directly to the component, you will not see the masking in the IDE, but you will when your run the app. If you apply the mask to an enclosing movieclip, again, it does not work in the IDE. However, if you first apply any filter to the containing movieclip (even a do-nothing filter like 'Adjust Color' with all settings at zero), then the mask works in the IDE. Why? I don't know. Seems to be a bug in Flash.

The perlin seed determines the wood or marble pattern. The pattern will always be the same for a given seed. If you want the pattern to change every time, use a seed of zero. This is useful if you have many instances -- chessboard squares for example -- and you want them to each be unique.

Please consider this software to be beta. I might change the parameter names in the future to make them more clear.

If you find any problems, let me know.