# AttachMovie within onEnterFrame

**URL:** https://forum.kirupa.com/t/attachmovie-within-onenterframe/139079
**Category:** Uncategorized
**Created:** [February 28, 2005, 8:03am UTC](https://forum.kirupa.com/t/attachmovie-within-onenterframe/139079 "2005-02-28T08:03:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![alwaysdrifting](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@alwaysdrifting](https://forum.kirupa.com/u/alwaysdrifting)
#### Post date: [February 28, 2005, 8:03am UTC](https://forum.kirupa.com/t/attachmovie-within-onenterframe/139079/1 "2005-02-28T08:03:39Z")

</div>

I’m having problems attaching a MC within a onEnterFrame function, it works outside just fine. Here is the code and problem:

```auto
var thb = this["image"+icount].container;
	//Load the images from the folder
	thb.loadMovie("01/snap"+icount+".jpg");
	temp = this.createEmptyMovieClip("tmp"+icount, 999);

	imagePreloader._x = 10;
	imagePreloader._y = image._y+Yval;
**[COLOR=Red]//Works fine here[/COLOR]	**
**imagePreloader.attachMovie("SessionLoader","SessionLoader",99);**
	
	thb._alpha = 0;

	
	**[COLOR=Blue]temp.onEnterFrame [/COLOR]** = function() {
		var t = thb.getBytesTotal();
		var l = thb.getBytesLoaded();
	**[COLOR=Red]// But won't attach here ?[/COLOR]	**
		

```

Any ideas?  
Thanks
