# Who knows how to animate a 'container'?

**URL:** <https://forum.kirupa.com/t/who-knows-how-to-animate-a-container/298022>\
**Category:** flash\
**Created:** [October 12, 2009, 4:35pm UTC](https://forum.kirupa.com/t/who-knows-how-to-animate-a-container/298022 "2009-10-12T16:35:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![atificial](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@atificial](https://forum.kirupa.com/u/atificial)\
**Post date:** [October 12, 2009, 4:35pm UTC](https://forum.kirupa.com/t/who-knows-how-to-animate-a-container/298022/1 "2009-10-12T16:35:39Z")

</div>

Hi,

[INDENT]_I am new to posting threads, but I have been an avid kirupa visitor for many years 🙂  
I figured if there is one place to find talented actionscripters it would be here!  
The time is 3:21 am here in Sydney and I am barely awake and I have nowhere else to turn, so any help would be greatly appreciated (and yes I am aware that the majority of threads contain those sweet words) 🙂_  
[/INDENT]  
I am simply trying to load an image externally, with a preloader. I know enough code (or how to search well enough) to be able to create a button and a container and to have that work without any errors (wow!) 🙂

What I am trying to achieve is to have the container that will load up the external JPEG be animated. For example, I have a button, and when I click on that button, an animation plays that has the container within itself. The container shows up in the last frame which has a stop(); action.

The problem is, the container only loads up the image if it is on the root of the timeline. I cannot seem to load the images into the container if it is within another movieClip.

This is the code that I have learnt to write, it is on the first frame of the root timeline:

```auto
var loader:MovieClipLoader = new MovieClipLoader();
container.createEmptyMovieClip ("container",1);

var preload:Object = new Object();
loader.addListener(preload);

preload.onLoadStart = function(target){

}

preload.onLoadProgress = function (target, loadedBytes, totalBytes){
bar_anim.pb.loader_txt.text = (Math.floor((loadedBytes/totalBytes)*100)+"%");
bar_anim.pb.bar_mc._xscale = (Math.floor((loadedBytes/totalBytes)*100));
bar_anim.pb.bar_mc._alpha = (Math.floor((loadedBytes/totalBytes)*100));
}

preload.onLoadComplete = function(target){

}

```

This is the code that is on the button, which controls when the image is loaded into the container:

```auto
on (rollOver){
	box.highlight.gotoAndPlay(2);
}
	
on (rollOut){
	box.highlight.gotoAndPlay(12);
}
	
on (release) {
	loader.loadClip("image1.jpg", container);
	content_anim.gotoAndPlay(2);

}

```

I LOVE YOU ALL!
