I am trying to make an image scrolling program…I had it so the first image worked fine, the mask did it’s job, then after that it didnt. Now I have it so you see the mask but it doesnt mask the images like it is supposed to. I have 4 images [image1_mc,image2_mc,image3_mc,image4_mc] I exported them to actionscript and the first frame…I have a mask that is reveal_mc that is also exported to actionscript and the first frame. The reveal_mc is just a simple rectangle growing from small to big.
Here is my code:
var imagePosition=2;
function dynamicMask(spaceInput,toBeMasked){
//unloadMovie(mask);
toBeMasked.setMask(null);
mask_mc=this.createEmptyMovieClip("mask", 2);
var spacing=0;
for(var i=0; i<=5;i++){
mask.attachMovie("reveal_mc","reveal_mc"+i,i);
mask["reveal_mc"+i]._y=spacing;
spacing+=spaceInput;
}
toBeMasked.setMask(mask);
}
//images_mc.attachMovie("image1_mc","image1_mc",2);
//dynamicMask(25,images_mc.image1_mc);
//imageToBack(images_mc.image1_mc);
nextImage();
function imageToBack(mc){
var temp="_level0.test."+mc;
var counter=0;
this.onEnterFrame=function(){
if(counter==50){
back_mc.attachMovie(temp,temp,1);
nextImage();
}
counter++;
}
}
function nextImage(){
var temp="_level0.test.images_mc.image"+imagePosition+"_mc";
images_mc.attachMovie("image"+imagePosition+"_mc","image"+imagePosition+"_mc",2);
dynamicMask(25,temp);
if(imagePosition==4){
imagePosition=1;
}else{
imagePosition++;
}
imageToBack("images_mc.image"+imagePosition+"_mc");
}
I keep track of the imagePosition, because I want it to continuously scroll thru…
The first function is SUPPOSED to make 6 copies of the reveal_mc and place them below each other, which is does that fine, but the part it doesn’t work fine is to mask the image…
I call the nextImage(); function to start the whole rotation, I commented off some of the other lines I was trying also
nextImage() is attaching the current image, ex image2_mc [the number is derived from the imagePosition variable], then it sends it to the dynamicMask function for it to mask the image, the if statement is just to make sure it doesn’t try to load an image that is not there, and start at 1 once it gets to the end…
Then my idea was the imageToBack(); function. I wanted to take the current loaded image (after it is masked and shown) to go to the back_mc, so when I call up the nextImage it gets tranisitioned on top of the underlying image, the counter in the imageToBack() function acts as a clock, to give it some time before processing…I also put the back_mc on level 1 and the other stuff one level 2…I have tested and tested and I ran out of ideas, so I HOPE someone can help me out! =)
Thanks for your help !!
Sincerely,
-TJ