[FMX] Semi-Dynamic Masking Gallery

Right. here goes… I’m loading 10 jpg images into _root.content.section_4.mc_anim, each is placed into its own movieClip.

_root.content.section_4.mc_anim["gall_img_"+img_view_index]

These movieclips are hidden and then have the images from an array loaded into them.


images = ['ourwork_01', 
		  'ourwork_02', 
		  'ourwork_03', 
		  'ourwork_04', 
		  'ourwork_05', 
		  'ourwork_06', 
		  'ourwork_07', 
		  'ourwork_08', 
		  'ourwork_09', 
		  'ourwork_10'];

so something like:


loadGallObj(path+images[img_load_index]+ext);

anyway, I have made a few masks, these masks are attached to the movie each time the imgTrans() function is called (every 5 seconds using setInterval()).


imgTrans = function(){
	mc_mask = _root.content.section_4.attachMovie(masks[mask_index], "mc_mask", 10);
	mc_mask._x = 72;
	mc_mask._y = 185;
	_root.content.section_4.img_view_last_index = (_root.content.section_4.img_view_last_index+1)%10;
	_root.content.section_4.mc_anim["gall_img_"+img_view_index]._alpha = 99;
	_root.content.section_4.mc_anim["gall_img_"+img_view_index].setMask(mc_mask);
	_root.content.section_4.mc_anim["gall_img_"+img_view_last_index].setMask(null);
	_root.content.section_4.mc_anim["gall_img_"+img_view_last_index]._alpha = 0;
	trace("Last image:"+img_view_last_index);
	_root.content.section_4.mask_index = (_root.content.section_4.mask_index+1)%_root.content.section_4.masks.length;
	_root.content.section_4.img_view_index = (_root.content.section_4.img_view_index+1)%_root.content.section_4.images.length;
};

Its all a bit of a mess really, apologies…
Anyway, these transitions work great, although after the last image is shown it is not hidden, I can’t quite work out how to loop the array back around like I have done with:


	_root.content.section_4.mask_index = (_root.content.section_4.mask_index+1)%_root.content.section_4.masks.length;

Does that all make sense?
Any ideas? :slight_smile: