The previous example performs the feat of keying using the setKey method of the Surface instance.
This method accepts the red, green, and blue values of the color you wanted masked as 8 - bit values
(0 to 255).
var red : Int = 0xFF;
var green : Int = 0x0;
var blue : Int = 0xFF;
srf.setKey( red, green, blue );
When working with image formats that support an alpha channel, remember that you can use this alpha
channel to define your character shapes. Try experimenting with alpha channels to get the effect that
works best.
Surface Transforms
The NME library provides three functions for transforming the image on a surface. Unfortunately, all
three of these functions work with the entire surface, though there are ways around using individual
images for each frame if you know what you ??™ re doing.
Two of the three functions used for transformation of Surfaces provide a distortion of the pixels. Both
of these functions perform a rotate and a scale on the source Surface . The first of these transform
functions, transform , has this signature.
Pages:
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007