# Using the same actionscript twice?

**URL:** <https://forum.kirupa.com/t/using-the-same-actionscript-twice/129091>\
**Category:** Uncategorized\
**Created:** [November 19, 2004, 11:22am UTC](https://forum.kirupa.com/t/using-the-same-actionscript-twice/129091 "2004-11-19T11:22:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthmahon](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@darthmahon](https://forum.kirupa.com/u/darthmahon)\
**Post date:** [November 19, 2004, 11:22am UTC](https://forum.kirupa.com/t/using-the-same-actionscript-twice/129091/1 "2004-11-19T11:22:53Z")

</div>

Hi,

Ok I think this should be possible but for the life of me I cannot get it to work. I want to use the same actionscript twice on the same movieclip. Let me explain - I have a sequence of images that I want to show, instead of just fading them in I want to use a mask that will grow in size to reveal them - the mask is an odd shape and gives me the effect I want.

This is the actionscript I am currently using on the first frame on the timeline in a layer called “Actions”:

[AS]  
//Main timeline  
function enlarge(endW, endH, speed){  
onEnterFrame = function(){  
mc\_rand2.\_width += (endW - mc\_rand2.\_width) / speed;  
mc\_rand2.\_height += (endH - mc\_rand2.\_height) / speed;

```
             if(mc_rand2._width == endW && mc_rand2._height == endH){
                     delete onEnterFrame;
             }
     }

```

}  
[/AS]

So, in my scene I also have movieclip called “mc\_rand2”. I have put the following code in this movieclip:

[AS]  
onClipEvent (enterFrame) {  
\_root.enlarge(1000, 700, 4);  
}  
[/AS]

Now, this works fine for the first movieclip that is in the timeline, but if there are two of the “mc\_rand2” movieclips on the timeline, then the second does not work - only the first.

Any ideas?

Cheers,  
Chris
