Hi all,
I am using the brush transition from senocular…its great but try as I might I cannot get it to go to the next frame after the transition. I have tried giving the frame a label and adding gotoAndPlay but this is not working.
Has anyone else used this transition successfully with other movieclips?
The AS2 code looks like this:
Stage.scaleMode = ‘noScale’;
var speedfactor = 2; // integer (runs through speedfactor frames of brush animation each frame)
// the smaller speedfactor is, the more efficient the trnasition, however, you may need
// to increase the speed of the brush animation if you want to cover all the area of the
// image as well as allow the transition to play at a reasonable (fast) speed
var images = [“hil”, “mtn”, “ice”]; // linkage ID list for bitmaps to transition to and from
var imagesindex = 0; // index for position in images list
var basepoint = new flash.geom.Point(0,0); // 0,0 point
// create bitmap instances
var displaybmp = new flash.display.BitmapData(1024,768); //
var transbmp = new flash.display.BitmapData(1024,768); //
var brushbmp = new flash.display.BitmapData(1024,768, true, 0); // brush shape for whipe effect
loadTransBitmap(images[imagesindex]);
displaybmp.draw(transbmp);
// attach brush animation which will be used to
// brush on transbmp to displaybmp
this.attachMovie(“brush”, “brush_mc”, 1);
brush_mc._visible = false; // dont allow brush to be seen
this.createEmptyMovieClip(“display_mc”,2); // create movie clip to show main bitmap
display_mc.attachBitmap(displaybmp, 1); // attach main bitmap
click_mc.swapDepths(3); // show click button above others
// when the mouse is clicked, initiate the transition
function onEnterFrame(){
// use loadTransBitmap to set transbmp to the next
// bitmap in the images list
loadTransBitmap( getNextImage() );
// begin the transition effect
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(){
brush_mc.gotoAndStop(1);
drawBrushToDisplay();
onEnterFrame = transOnEnterFrame;
}
function transOnEnterFrame(){
var i = speedfactor;
while (i–){
brush_mc.nextFrame();
drawBrushToDisplay();
if (brush_mc._currentframe >= brush_mc._totalframes){
displaybmp.draw(transbmp);
delete this.onEnterFrame;
break;
}
}
}
function drawBrushToDisplay(){
brushbmp.fillRect(brushbmp.rectangle,0);
brushbmp.draw(brush_mc);
displaybmp.copyPixels(transbmp,transbmp.rectangle,basepoint,brushbmp,basepoint,true);
}