Use the As script to parse the transition between two images.
Package {
Import flash. display. Sprite;
Import flash. display. Bitmap;
Import flash. display. bitmapdata;
Import flash. Events. event;
Import flash. Geom. Point;
Public class dissolve extends sprite {
Private VaR _ bitmap: bitmapdata;
Private VaR _ bitmap2: bitmapdata;
Private VaR _ image: bitmap;
Private VaR _ seed: number;
Private VaR _ pixelcount: Int = 0;
Public Function dissolve ()
{
// Create a White Rectangle
_ Bitmap = new bitmapdata (stage. stagewidth,
Stage. stageheight,
False, 0 xffffffff );
// Create a black rectangle
_ Bitmap2 = new bitmapdata (stage. stagewidth,
Stage. stageheight,
False, 0xff000000 );
// Bitmapdata object can not be displayed in the window,
// Yet bitmap is accepted.
_ Image = new Bitmap (_ Bitmap );
// Show the white rectangel
Addchild (_ image );
// Set a random number to dissolve between the two bitmap
_ Seed = math. Random () * 100000;
// Begin dissolve when the frame show or say it when you enter the frame.
Addeventlistener (event. enter_frame, onenterframe );
}
Public Function onenterframe (Event: Event): void
{
// Copy 1000 random points from bitmap2 which is the destine bitmap to bitmap
// Which is the start bitmap.
_ Seed = _ bitmap. pixeldissolve (_ bitmap2,
_ Bitmap. rect,
New Point (),
_ Seed,
1000 );
_ Pixelcount + = 1000;
// If we have copied all the points in bitmap2, remove the event.
If (_ pixelcount> _ bitmap. Width * _ bitmap. Height ){
Removeeventlistener (event. enter_frame,
Onenterframe );
}
}
}
}