# \[Flash8\] duplicateMovieClip not working inside a function

**URL:** <https://forum.kirupa.com/t/flash8-duplicatemovieclip-not-working-inside-a-function/192251>\
**Category:** flash\
**Created:** [June 27, 2006, 8:41am UTC](https://forum.kirupa.com/t/flash8-duplicatemovieclip-not-working-inside-a-function/192251 "2006-06-27T08:41:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darth](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@darth](https://forum.kirupa.com/u/darth)\
**Post date:** [June 27, 2006, 8:41am UTC](https://forum.kirupa.com/t/flash8-duplicatemovieclip-not-working-inside-a-function/192251/1 "2006-06-27T08:41:25Z")

</div>

Hi.

I have duplicateMovieClip action inside a fuction and it doesnt work, however it works when placed outside of this function, right where the function is defined, 1st frame.

// WORKS WHEN PLACED HERE image\_mc.duplicateMovieClip(“newname”, this.getNextHighestDepth());

function fadeimage() {  
var a:Number = 10;  
var l:Number = 0;  
var o:Number = 100;  
var t:Number = 0;  
image\_mc.duplicateMovieClip(“newname”, this.getNextHighestDepth()); // DOESNT WORK HERE  
this.onEnterFrame = function() {  
if (t == a) {  
delete this.onEnterFrame;  
setscroll();  
} else {  
image\_mc.\_alpha = Quart.easeOut(t, l, o, a);  
t++;  
}  
};  
}

fadeimage function is triggered when image file has been loaded to image\_mc.

what am I doing wrong? please help!
