EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 325

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BitmapData (flash.display.BitmapData) 325
randomSeed:Number [optional] - The random seed to use to start the pixel dissolve. The
default value is 0.
numberOfPixels:Number [optional] - The default is 1/30 of the source area (width x height).
fillColor:Number [optional] - An ARGB color value that you use to fill pixels whose source
value equals its destination value. The default value is 0.
Returns
Number - The new random seed value to use for subsequent calls.
Example
The following example uses
pixelDissolve() to convert a grey BitmapData object to a red
one by dissolving 40 pixels at a time until all 8000 pixels have changed colors:
import flash.display.BitmapData;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
mc.onPress = function() {
var randomNum:Number = Math.floor(Math.random() * 10);
dissolve(randomNum);
}
var intervalId:Number;
var totalDissolved:Number = 0;
var totalPixels:Number = 8000;
function dissolve(randomNum:Number) {
var newNum:Number = myBitmapData.pixelDissolve(myBitmapData,
myBitmapData.rectangle, new Point(0, 0), randomNum, 40, 0x00FF0000);
clearInterval(intervalId);
if(totalDissolved < totalPixels) {
intervalId = setInterval(dissolve, 10, newNum);
}
totalDissolved += 40;
}

Table of Contents

Related product manuals