# I've found this code and I want to add

**URL:** <https://forum.kirupa.com/t/ive-found-this-code-and-i-want-to-add/6328>\
**Category:** flash\
**Created:** [October 4, 2002, 9:11am UTC](https://forum.kirupa.com/t/ive-found-this-code-and-i-want-to-add/6328 "2002-10-04T09:11:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)\
**Post date:** [October 4, 2002, 9:11am UTC](https://forum.kirupa.com/t/ive-found-this-code-and-i-want-to-add/6328/1 "2002-10-04T09:11:16Z")

</div>

I’ve found the code below in a thread and wondered where I would add

on (rollOver) {  
this.swapDepths(3);  
}  
on (rollOut) {  
this.swapDepths(1);  
}

so that I can use multiple examples of the same code in boxes on screen

onClipEvent (load) {  
this.\_alpha = 30; //set original alpha  
}  
onClipEvent (enterFrame) {  
function fadeOut() {  
if (this.\_alpha\>30) {  
this.\_alpha -= 10;  
} else {  
this.onEnterFrame = null;  
}  
}  
// this function increases the \_alpha of the object calling it  
// when it reaches 100, it deletes its enterFrame  
function fadeIn() {  
if (this.\_alpha\<100) {  
this.\_alpha += 10;  
} else {  
this.onEnterFrame = null;  
}  
}  
this.onRollOver = function() {  
// when you roll over the button, you define its enterFrame as the  
// function you have just declared. You could hard code it, but it is  
// clearer that way and more reusable  
this.onEnterFrame = fadeIn;  
};  
this.onRollOut = function() {  
this.onEnterFrame = fadeOut;  
};  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 4, 2002, 9:50am UTC](https://forum.kirupa.com/t/ive-found-this-code-and-i-want-to-add/6328/2 "2002-10-04T09:50:51Z")

</div>

Check your pms.
