# Dynamic Mask

**URL:** https://forum.kirupa.com/t/dynamic-mask/219033
**Category:** Uncategorized
**Created:** [March 13, 2007, 9:54am UTC](https://forum.kirupa.com/t/dynamic-mask/219033 "2007-03-13T09:54:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rafimmedia](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@rafimmedia](https://forum.kirupa.com/u/rafimmedia)
#### Post date: [March 13, 2007, 9:54am UTC](https://forum.kirupa.com/t/dynamic-mask/219033/1 "2007-03-13T09:54:23Z")

</div>

hi i am trying to a XML Photo Gallery using Kirupa’s code as bellwo  
This code Contain fadein fadeout effects(alpha Down,UP) for images . But i want to attach a MC as a Mask . That MC has a Tweened box zoom in animation. How to attach that MC as a Mask. and also i nedd this effects applies (MC effct) to preloder also. Please help me

[http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm)

## Kirupa’s Code.

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
}  
firstImage();  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“1\_gallery.xml”);  
/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
} else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
Key.addListener(listen);  
prevBtn.onRelease = function() {  
prevImage();  
};  
nextBtn.onRelease = function() {  
nextImage();  
};  
/////////////////////////////////////  
p = 0;  
this.onEnterFrame = function() {  
filesize = pics.getBytesTotal();  
loaded = pics.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (pics.\_alpha\<100) {  
pics.\_alpha += 10;  
}  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
pics.\_alpha = 0;  
pics.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
pics\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
pics.\_alpha = 0;  
pics.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
pics\_num();  
}  
}  
function firstImage() {  
if (loaded == filesize) {  
pics.\_alpha = 0;  
pics.loadMovie(image[0], 1);  
desc\_txt.text = description[0];  
pics\_num();  
}  
}  
function pics\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}
