User Guide
BitmapData (flash.display.BitmapData) 323
baseY:Number - Frequency to use in the y direction. For example, to generate a noise that is
sized for a 64 x 128 image, pass 128 for the
baseY value.
numOctaves:Number - Number of octaves or individual noise functions to combine to create
this noise. Larger numbers of octaves create images with greater detail. Larger numbers of
octaves also require more processing time.
randomSeed:Number - The random seed number to use. If you keep all other parameters the
same, you can generate different pseudo-random results by varying the random seed value.
The Perlin noise function is a mapping function, not a true random-number generation
function, so it creates the same results each time from the same random seed.
stitch:Boolean - A Boolean value. If the value is true, the method attempts to smooth the
transition edges of the image to create seamless textures for tiling as a bitmap fill.
fractalNoise:Boolean - A Boolean value. If the value is true, the method generates fractal
noise; otherwise, it generates turbulence. An image with turbulence has visible discontinuities
in the gradient that can make it better approximate sharper visual effects, like flames and
ocean waves.
channelOptions:Number [optional] - A number that indicates one or more color channels.
To create this value, you can use or combine any of the four color channel values:
1 (red), 2
(green),
4 (blue), and 8 (alpha). You can combine the channel values by using the logical OR
operator; for example, you can combine the red and green channels by using the following
code:
1 | 2.
grayScale:Boolean [optional] - A Boolean value. If the value is true, a grayscale image is
created by setting each of the red, green, and blue color channels to identical values. The
alpha channel value is not affected if this value is set to
true. The default value is false.
offsets:Object [optional] - An array of points that correspond to x and y offsets for each
octave. By manipulating the offset values you can smoothly scroll the layers of a perlinNoise
image. Each point in the offset array affects a specific octave noise function.
Example
The following example shows how to apply Perlin noise to to a BitmapData object.
import flash.display.BitmapData;
var bitmapData_1:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var bitmapData_2:BitmapData = new BitmapData(100, 80, false, 0x00FF0000);
var mc_1:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());