| Package | graphics.display |
| Class | public class Pattern |
| Inheritance | Pattern flash.display.BitmapData |
| Method | Defined By | ||
|---|---|---|---|
Pattern(tiles:Array, colors:Array)
Creates a new Pattern instance. | Pattern | ||
| Pattern | () | Constructor |
public function Pattern(tiles:Array, colors:Array)Creates a new Pattern instance.
Example :
package examples
{
import graphics.FillBitmapStyle;
import graphics.display.Pattern;
import graphics.drawing.RectanglePen;
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Matrix;
[SWF(width="780", height="520", frameRate="24", backgroundColor="#FFFFFF")]
public class ExamplePattern extends Sprite
{
public function ExamplePattern()
{
var shape:Shape = new Shape() ;
shape.x = 20 ;
shape.y = 20 ;
addChild( shape ) ;
var tiles:Array =
[
[1, 0, 0, 0] ,
[0, 0, 0, 0] ,
[0, 0, 1, 0] ,
[0, 0, 0, 0]
];
var colors:Array = [ 0x00 , 0xFF000000 ] ;
var pattern:Pattern = new Pattern(tiles, colors) ;
var pen:RectanglePen = new RectanglePen( shape ) ;
pen.fill = new FillBitmapStyle( pattern , new Matrix() , true ) ;
pen.draw( 0, 0 , 150, 150 ) ;
}
}
}
Parameters tiles:Array — The Array matrix representation of all pixels of the pattern.
| |
colors:Array — The Array representation of all decimal RGBA colors values used in the tiles object.
|