# AttachMovie Not Working With Tween Class

**URL:** <https://forum.kirupa.com/t/attachmovie-not-working-with-tween-class/209444>\
**Category:** flash\
**Created:** [December 8, 2006, 8:43pm UTC](https://forum.kirupa.com/t/attachmovie-not-working-with-tween-class/209444 "2006-12-08T20:43:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kovax](https://avatars.discourse-cdn.com/v4/letter/k/7ab992/32.png) [@Kovax](https://forum.kirupa.com/u/Kovax)\
**Post date:** [December 8, 2006, 8:43pm UTC](https://forum.kirupa.com/t/attachmovie-not-working-with-tween-class/209444/1 "2006-12-08T20:43:06Z")

</div>

Hi,

I’m trying to load different images into a container movie clip when buttons are pressed using the code below. The images are in the library and do not need to be preloaded. I would like the sequence to work as follows:

1. Press button
2. Fade out container
3. Attach appropriate image
4. Fade in container

It seems like the container is fading in and out, but the image is not attaching through the code in the onMotionFinished block.

Any help would be appreciated. Thanks!

///////////////////////////////////////////////

one.onRelease = function()  
{  
// fade out container  
tween\_handler = new Tween(container1, “\_alpha”, Regular.easeOut, container1.\_alpha, 0, 1, true);  
tween\_handler.onMotionFinished = function() {  
// unload container  
unloadMovie(container1);  
// attach appropriate movie clip  
container1.attachMovie(“image1”, “image1”, this.getNextHighestDepth());  
// fade in container  
new Tween(container1, “\_alpha”, Regular.easeOut, container1.\_alpha, 100, 1, true);  
}  
}

two.onRelease = function()  
{  
// fade out container  
tween\_handler = new Tween(container1, “\_alpha”, Regular.easeOut, container1.\_alpha, 0, 1, true);  
tween\_handler.onMotionFinished = function() {  
// unload container  
unloadMovie(container1);  
// attach appropriate movie clip  
container1.attachMovie(“image2”, “image2”, this.getNextHighestDepth());  
// fade in container  
new Tween(container1, “\_alpha”, Regular.easeOut, container1.\_alpha, 100, 1, true);  
}  
}
