# Senocular's Dissolve Transition

**URL:** <https://forum.kirupa.com/t/senoculars-dissolve-transition/310589>\
**Category:** flash\
**Created:** [June 14, 2010, 2:07pm UTC](https://forum.kirupa.com/t/senoculars-dissolve-transition/310589 "2010-06-14T14:07:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![somnamblst](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@somnamblst](https://forum.kirupa.com/u/somnamblst)\
**Post date:** [June 14, 2010, 2:07pm UTC](https://forum.kirupa.com/t/senoculars-dissolve-transition/310589/1 "2010-06-14T14:07:07Z")

</div>

I have modified Senocular’s Dissolve transition: :ponder:

[http://www.senocular.com/flash/source/?entry=746](http://www.senocular.com/flash/source/?entry=746)

to play automatically, changing onMouseDown function to onEnterFrame so the dissolve to happens automatically. However, it only executes once, so I am unable to cycle through more than 2 images. Any insight appreciated.

```auto
var frames = 66;
var images = ["flight", "lakes"];

var imagesindex = 0;
var framecount = 0;
var transarea = 0;
var basepoint = new flash.geom.Point(0,0);
var displaybmp = new flash.display.BitmapData(300,196);
var transbmp = new flash.display.BitmapData(300,196);

loadTransBitmap( images[imagesindex] );
displaybmp.draw(transbmp);

this.createEmptyMovieClip("display_mc", 1);
display_mc._y = 25;
display_mc._x = 0;
click_mc.swapDepths(2);
display_mc.attachBitmap(displaybmp, 1);

this.onEnterFrame = function(){
//function onMouseDown(){
    loadTransBitmap( getNextImage() );
    startTransition();
}

function getNextImage(){
    imagesindex++;
    imagesindex %= images.length;
    return images[imagesindex];
}

function loadTransBitmap(id){
    var tempbmp = flash.display.BitmapData.loadBitmap(id);
    transbmp.copyPixels(tempbmp, tempbmp.rectangle, basepoint);
    tempbmp.dispose();
}

function startTransition(){
    framecount = 0;
    transarea = transbmp.width * transbmp.height;
    onEnterFrame = transOnEnterFrame;
}

function transOnEnterFrame(){
    framecount++;
    var amount = transarea * framecount/frames;
    displaybmp.pixelDissolve(transbmp, transbmp.rectangle, basepoint, 0, amount);
    if (framecount >= frames){
        delete this.onEnterFrame;

    }
}

```
