PDA

View Full Version : setMask problem



rollwithit80
May 2nd, 2007, 06:15 AM
Hi Guys,
Im trying to do this transition effect and been working on it for a while now.

I have a movie clip imageMC with a clipMC inside it where an external image is loaded into it. The movieClip is duplicted then resizes and fades out using the following code:


function loadImage(pic){

pos=pos+1;
var clip=imageMC.duplicateMovieClip("cont"+pos, this.getNextHighestDepth());
curIm.setMask(maskMC);
clip.swapDepths(curIm);
curImage.scaleIt();

curImage=clip.clipMC;
curIm=clip;

curImage.loadMovie(pic);
curImage._x=-maskMC._width/2;
curImage._y=-maskMC._height/2;
clip.setMask(maskMC);
}


MovieClip.prototype.scaleIt = function() {
//trace(this);
var speed = 2;
var spacing=0;
var duration = 10;
var step = 100/duration;
this._alpha = 100;
this.setMask(maskMC);
this.onEnterFrame =function(){
//this.setMask(maskMC);
this._x = -this._width/speed;
this._y = -this._height/speed;
this._alpha -= step;

if (this._xscale<500) {
this._width += 50;
this._yscale = this._xscale;
//this.setMask(maskMC);
} else {
delete this.onEnterFrame;
this.unloadMovie();
this._yscale = this._xscale=500;
}
}
};

However i want to mask the movieclip when it resizes but it doesnt seem to work. I have attached the fla so you can see what i have done. You will need to create 4 images p.jpeg, p1.jpeg, p2.jpgp3.jpg

Thanks

Daniel

rollwithit80
May 2nd, 2007, 07:10 PM
bump... cant get setMask to work.

Daniel

rollwithit80
May 2nd, 2007, 09:42 PM
Ahh i figured out why the setMask wasn't working thanks to this forum post.
http://www.kirupa.com/forum/showthread.php?t=258213&highlight=setMask

I fond out that setMask only accepts one mask and one maskee.

So i had to duplicate one mask for every movieClip.


function loadImage(pic){

pos=pos+1;
trace(pos);
var clip=imageMC.duplicateMovieClip("cont"+pos, this.getNextHighestDepth());
var mask=maskMC.duplicateMovieClip("mask"+pos, this.getNextHighestDepth());
mask._visible=0;
curIm.setMask(maskMC);
clip.swapDepths(curIm);
curIm.setMask(maskMC);
curImage.setMask(mask);
trace(pic+' '+curPic);

curImage.scaleIt();

curImage=clip.clipMC;
curIm=clip;
curPic=pic;
curImage.loadMovie(pic);
curImage._x=(-maskMC._width/2)+15;
curImage._y=-maskMC._height/2+10;
clip.setMask(maskMC);
}

Daniel