# Function not working after Clip is loaded, unloaded and then loaded again

**URL:** <https://forum.kirupa.com/t/function-not-working-after-clip-is-loaded-unloaded-and-then-loaded-again/218359>\
**Category:** flash\
**Created:** [March 7, 2007, 4:09am UTC](https://forum.kirupa.com/t/function-not-working-after-clip-is-loaded-unloaded-and-then-loaded-again/218359 "2007-03-07T04:09:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kane357](https://avatars.discourse-cdn.com/v4/letter/k/2acd7d/32.png) [@Kane357](https://forum.kirupa.com/u/Kane357)\
**Post date:** [March 7, 2007, 4:09am UTC](https://forum.kirupa.com/t/function-not-working-after-clip-is-loaded-unloaded-and-then-loaded-again/218359/1 "2007-03-07T04:09:01Z")

</div>

I have a Movie Clip in my Library that I’m loading on to my stage using the attachMovie command. Within that movie clip, I have actions set on the first frame.

From the root level of my movie, I call “profile-section” clip by pressing a button in my nav and it loads properly and works. The functions and handlers all work correctly within it. Then when I press another button from the root level, I have code to removeMovieClip. That works and removes the “profile-section” clip.

My problem is when i click on the button to re-load the “profile-section”, the function doesn’t work properly anymore. I’m attaching the function for you guys to look over. Any help would be greatly appreciated. Thanks.

//  
// Variables  
//

var speed = 3;

//  
// Sub-Section Rollover Red Bar Function  
//

function subSectionRollOverLoop(movieClip, speed, distance, callBack):Void {  
if (speed \> 0 && movieClip.\_width \<= distance) {  
movieClip.\_width += speed;  
} else if (speed \< 0 && movieClip.\_width \>= distance) {  
movieClip.\_width += speed;  
} else if (movieClip.\_\_interval) {  
clearInterval(movieClip.\_\_interval);  
movieClip.\_\_interval = 0;  
if (callBack) {  
callBack(movieClip, speed, distance);  
}  
}  
}

function subSectionRollOverStart(movieClip, speed, distance, callBack):Void {  
if (movieClip.\_\_interval) {  
clearInterval(movieClip.\_\_interval);  
movieClip.\_\_interval = 0;  
}  
movieClip.\_\_interval = setInterval(subSectionRollOverLoop, 10, movieClip, speed, distance, callBack);  
}

joan\_btn.onRollOver = joan\_btn.onDragOver = function ():Void {  
subSectionRollOverStart(joanRoll\_mc, 30, 140);  
};
