# Slow Drop Shadow On XML Images, Bitmap Caching?

**URL:** <https://forum.kirupa.com/t/slow-drop-shadow-on-xml-images-bitmap-caching/189107>\
**Category:** flash\
**Created:** [May 13, 2006, 8:12pm UTC](https://forum.kirupa.com/t/slow-drop-shadow-on-xml-images-bitmap-caching/189107 "2006-05-13T20:12:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBN](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbn/32/2239_2.png) [@JBN](https://forum.kirupa.com/u/JBN)\
**Post date:** [May 13, 2006, 8:12pm UTC](https://forum.kirupa.com/t/slow-drop-shadow-on-xml-images-bitmap-caching/189107/1 "2006-05-13T20:12:04Z")

</div>

Alright, here’s something I’ve been wanting to add to my site for a long time, but it slowed it down too much. Check out [www.jbnight.com](http://www.jbnight.com) The images are loaded via XML. I really want a nice drop shadow behind each image (they are all different sizes) to seperate them from the background better. However, adding it in AS as the image loads slows the site down horribly. I’ve been working on an intro animation and am learning about the new bitmap caching feature. Would adding some AS to bitmap cache the DS help, or because they are all different DS, would it not help at all? If this would help, how would I implement the AS?

Here is the AS for the galleries. I believe I put the DS in the FadeIn function before, and it was very slow:

stop();  
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;  
}  
id = setInterval(preloadPic, 100);  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“behindthescenes.xml”);  
var p = 0;  
var current;  
var k = 0;  
// ////////////////////////////////  
function preloadPic() {  
clearInterval(id);  
var con = picture.duplicateMovieClip(“con”+k, 9984+k);  
con.loadMovie(image[p]);  
preloader.\_visible = 1;  
con.\_alpha = 0;  
var temp = \_root.createEmptyMovieClip(“temp”+k, 99+k);  
k++;  
temp.onEnterFrame = function() {  
var total = con.getBytesTotal();  
var loaded = con.getBytesLoaded();  
percent = Math.round(loaded/total\*100);  
preloader.preload\_bar.\_xscale = percent;  
if (con.\_width) {  
con.\_x = Stage.width/2-(con.\_width/2)  
preloader.\_visible = 0;  
con.onEnterFrame = fadeIn;  
delete this.onEnterFrame;  
}  
};  
}  
MovieClip.prototype.fadeIn = function() {  
if (this.\_alpha\<100) {  
current.\_alpha -= 4;  
this.\_alpha += 4;  
} else {  
current.\_visible = 0;  
current = this;  
delete this.onEnterFrame;  
}  
desc\_txt.text = description[p];  
picture\_num();  
};  
function nextImage() {  
p\<total-1 ? (p++, preloadPic()) : null;  
desc\_txt.text = description[p];  
picture\_num();  
}  
function prevImage() {  
p\>0 ? (p–, preloadPic()) : null;  
desc\_txt.text = description[p];  
picture\_num();  
}  
function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}  
listen = new Object();  
Key.addListener(listen);  
previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};  
Actions.gotoAndPlay = function(gotoAndPlay) {  
if (\_root.current != undefined) {  
\_root.current.onEnterFrame = function() {  
this.\_alpha -= 7;  
if (this.\_alpha\<0) {  
this.\_alpha = 0;  
\_root.gotoAndPlay(gotoAndPlay);  
delete this.onEnterFrame;  
}  
};  
} else {  
\_root.gotoAndPlay(gotoAndPlay);  
}  
};
