# Need help integrating a bit of code to gallery

**URL:** https://forum.kirupa.com/t/need-help-integrating-a-bit-of-code-to-gallery/236682
**Category:** flash
**Created:** [August 22, 2007, 8:38pm UTC](https://forum.kirupa.com/t/need-help-integrating-a-bit-of-code-to-gallery/236682 "2007-08-22T20:38:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tile\_nipper](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@tile\_nipper](https://forum.kirupa.com/u/tile_nipper)
#### Post date: [August 22, 2007, 8:38pm UTC](https://forum.kirupa.com/t/need-help-integrating-a-bit-of-code-to-gallery/236682/1 "2007-08-22T20:38:09Z")

</div>

I’m using the Kirupa Web Gallery tutorial to build a photo gallery using xml. I’d like to incorporate the exposure fade in and out on the pictures. I have the code that photoshop using to create this effect. But I am not quite sure how to work it into the code for the gallery. I think [COLOR=“red”]this is all of the code relating to how the images currently load and transition:[/COLOR]

p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
function firstImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[0], 1);  
desc\_txt.text = description[0];  
picture\_num();  
}  
}

[COLOR=“Red”]This is the transition code for the exposure fade in and out from photoshop:[/COLOR]

// This handles the image dissolve to white effect

// usage  
// image\_mc.colorFade(100, 0, 100, 0, 100, 0, 100, 0, this, ‘done’);

MovieClip.prototype.colorFade = function(r1, r2, g1, g2, b1, b2, a1, a2, obj, callback) {  
var c = new Color(this);  
var tV = [r1, r2, g1, g2, b1, b2, a1, a2];  
var speed = 1.5;  
var margin = 10;  
this.onEnterFrame = function() {  
cV = [c.getTransform().ra, c.getTransform().rb, c.getTransform().ga, c.getTransform().gb, c.getTransform().ba, c.getTransform().bb, c.getTransform().aa, c.getTransform().ab];  
change = {ra:tV[0]-(tv[0]-cV[0])/speed, rb:tV[1]-(tv[1]-cV[1])/speed, ga:tV[2]-(tv[2]-cV[2])/speed, gb:tV[3]-(tv[3]-cV[3])/speed, ba:tV[4]-(tv[4]-cV[4])/speed, bb:tV[5]-(tv[5]-cV[5])/speed, aa:tV[6]-(tv[6]-cV[6])/speed, ab:tV[7]-(tv[7]-cV[7])/speed};  
c.setTransform(change);  
if (cV[0]\>tV[0]-margin && cV[0]\<tV[0]+margin && cV[1]\>tV[1]-margin && cV[1]\<tV[1]+margin && cV[2]\>tV[2]-margin && cV[2]\<tV[2]+margin && cV[3]\>tV[3]-margin && cV[3]\<tV[3]+margin && cV[4]\>tV[4]-margin && cV[4]\<tV[4]+margin && cV[5]\>tV[5]-margin && cV[5]\<tV[5]+margin) {  
objcallback;  
delete (this.onEnterFrame);  
}  
};  
};

Can someone help me to integrate the two together?
