This content has been marked as final.
Show 1 reply
-
1. Re: Should I be using setMask()
Push76 Feb 15, 2007 7:20 AM (in response to Push76)Ok, so I knocked up an example...Unfortunately I couldn't get the setMask() method to do what I wanted it to do so I've done it a different way....I'd be interested to see a code example using the setMask() method or if anyone knows a better way of doing this I'd be interested in seeing it...
I have 5 layers (in this order):
1. Actions.
2. Mask (which includes my "star_mask" movie clip. This movie clip has the instance name "the_photo_mask")
3. New Photo (which is masked by my "mask" layer and includes an empty movie clip with the instance name "new_photo")
4. Last Photo (Not masked. This layer includes an empty movie clip with the instance name "last_photo")
5. Buttons (which includes the thumbnail buttons). There are no actions directly on the buttons.
Other Info:
The main time line is 1 frame long.
I have 3 jpgs sitting in the same folder as the .fla and .swf file. (these are glassesGirl.jpg, brownHairGirl.jpg and windyGirl.jpg)
In the single frame on my "Actions" layer I have the following actionscript:
stop();
var the_last_photo = "GlassesGirl.jpg";
//Load a default image into the bottom layer (the blonde chick in the glasses)
loadMovie(the_last_photo, last_photo_holder);
btnGlassesGirl.onRelease = function(){
the_last_photo = "GlassesGirl.jpg";
loadMovie("GlassesGirl.jpg", new_photo_holder);
the_photo_mask.gotoAndPlay("show");
};
btnBrownHairGirl.onRelease = function(){
the_last_photo = "BrownHairGirl.jpg";
loadMovie("BrownHairGirl.jpg", new_photo_holder);
the_photo_mask.gotoAndPlay("show");
};
btnWindyGirl.onRelease = function(){
the_last_photo = "WindyGirl.jpg";
loadMovie("WindyGirl.jpg", new_photo_holder);
the_photo_mask.gotoAndPlay("show");
};
function loadLastPhoto(photo){
//trace("in loadLastPhoto function. Last Photo = " + photo);
last_photo_holder.loadMovie(photo);
}
Info about the star_mask movie clip
On the 1st frame of this movie clip there is a stop(); action.
The 2nd frame is labelled "show".
The movie clip contains several layers (on each layer there is a star animation of a start slowly growing bigger).
Each star contributes to an animation which covers up an area the size of one of the full size jpg images)
The last frame contains the following actionscript:
stop();
_root.loadLastPhoto(_root.the_last_photo);
So as you can see I haven't used setMask() method. If I want to add more thumbnails I just need to add a function of this format:
btnThumbnailInstanceName.onRelease = function(){
the_last_photo = "PhotoName.jpg";
loadMovie("PhotoName.jpg", new_photo_holder);
the_photo_mask.gotoAndPlay("show");
};
Does anyone have any thoughts on if this is the best/worst way to achieve the technique described in my original post?
Cheers
Push