# attachMovie

**URL:** <https://forum.kirupa.com/t/attachmovie/329302>\
**Category:** Uncategorized\
**Created:** [August 11, 2012, 6:35am UTC](https://forum.kirupa.com/t/attachmovie/329302 "2012-08-11T06:35:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenicun](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jenicun](https://forum.kirupa.com/u/jenicun)\
**Post date:** [August 11, 2012, 6:35am UTC](https://forum.kirupa.com/t/attachmovie/329302/1 "2012-08-11T06:35:46Z")

</div>

I have swf calling external swf

AS 2 on swf1 :

container.loadMovie(“c:/flashtest/a1.swf”,00);  
\_root.container.play();

Quote AS 2 on swf 2 :

> 

//Paste this code at the top of your existing code to be able to use the Tween Class

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

popup.\_alpha = 0;

this.createEmptyMovieClip(“container”,1);  
var imagesNumber:Number = 5;  
var scrolling:Boolean = true;

for (i=0; i\<imagesNumber; i++) {  
container.attachMovie(“thumb”+i,“thumb”+i+“\_mc”,i+2);  
myThumb\_mc = container[“thumb”+i+“\_mc”];  
myThumb\_mc.\_x = (i-1)\*myThumb\_mc.\_width;  
myThumb\_mc.\_y = (576-myThumb\_mc.\_height)/2;  
myThumb\_mc.\_alpha = 50;  
myThumb\_mc.largerImage = i;  
myThumb\_mc.onRollOver = function() {  
this.\_alpha = 100;

```
};
myThumb_mc.onRollOut = function() {
	this._alpha = 50;
	
};
myThumb_mc.onRelease = function() {
	this._alpha=50;
	for (i=1; i&lt;=imagesNumber; i++) {
		var myClip = container["thumb"+i+"_mc"];
		myClip.enabled = false;
	}
	scrolling = false;
	_root.attachMovie("image"+this.largerImage,"large_mc",i+10);
	large_mc._x = (768-large_mc._width)/2;
	large_mc._y = (576-large_mc._height)/2;
	//fadein fadeout speed (container name, tween type, base alpa, target, speed, boolean);
	new Tween(large_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);
	new Tween(container, "_alpha", Strong.easeOut, 100, 50, 1, true);
	large_mc.onRelease = function() {
		this.enabled=false;
		scrolling = true;
		var myFadeOut = new Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
		new Tween(container, "_alpha", Strong.easeOut, 50, 100, 0.5, true);
		myFadeOut.onMotionFinished = function() {
			for (i=1; i&lt;=imagesNumber; i++) {
				var myClip = container["thumb"+i+"_mc"];
				myClip.enabled = true;
			}
			large_mc.removeMovieClip();
			
		};
	};
};

```

}  
container.onEnterFrame = function() {  
if (scrolling) {  
this.\_x += Math.cos((-\_root.\_xmouse/576)\*Math.PI)\*15;  
if (this.\_x\>0) {  
this.\_x = 0;  
}  
if (-this.\_x\>(this.\_width-576)) {  
this.\_x = -(this.\_width-576);  
}  
}

};

When I clicken on the image, it stopped. Anyone know why ?
