I want to dissolve one image to another. I imported my two images to the stage (they are bitmaps of the same size). I then converted them to mc instances called greencol and redcol. I left them on the stage but pushed them to the far right of the main stage. The transition sort of works it dissolves from green to white, but I want it to dissolve to red the colour of the second mc instance. My problem is that it does not seem able to see redcol, thanks for any advice.
import flash.display.BitmapData;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(greencol._width, greencol._height);
myBitmapData.draw(greencol);
var mc:MovieClip = this.createEmptyMovieClip("mc",this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
var myBitmapData1:BitmapData = new BitmapData(redcol._width, redcol._height);
//var mc1:MovieClip = this.createEmptyMovieClip("mc1",this.getNextHighestDepth());
//mc1.attachBitmap(myBitmapData1, 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 = 59000;
function dissolve(randomNum:Number) {
var newNum:Number = myBitmapData.pixelDissolve(myBitmapData1, myBitmapData1.rectangle, new Point(0, 0), randomNum, 40, 0x00FF0000);
clearInterval(intervalId);
if(totalDissolved < totalPixels) {
intervalId = setInterval(dissolve, 10, newNum);
}
totalDissolved += 140;
}
import flash.display.BitmapData;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(greencol._width, greencol._height);
myBitmapData.draw(greencol);
var mc:MovieClip = this.createEmptyMovieClip("mc",this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
var myBitmapData1:BitmapData = new BitmapData(redcol._width, redcol._height);
//var mc1:MovieClip = this.createEmptyMovieClip("mc1",this.getNextHighestDepth());
//mc1.attachBitmap(myBitmapData1, 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 = 59000;
function dissolve(randomNum:Number) {
var newNum:Number = myBitmapData.pixelDissolve(myBitmapData1, myBitmapData1.rectangle, new Point(0, 0), randomNum, 40, 0x00FF0000);
clearInterval(intervalId);
if(totalDissolved < totalPixels) {
intervalId = setInterval(dissolve, 10, newNum);
}
totalDissolved += 140;
}