# Controlling movie clips on the stage

**URL:** <https://forum.kirupa.com/t/controlling-movie-clips-on-the-stage/260766>\
**Category:** flash\
**Created:** [May 19, 2008, 6:18pm UTC](https://forum.kirupa.com/t/controlling-movie-clips-on-the-stage/260766 "2008-05-19T18:18:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tslawrence](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@tslawrence](https://forum.kirupa.com/u/tslawrence)\
**Post date:** [May 19, 2008, 6:18pm UTC](https://forum.kirupa.com/t/controlling-movie-clips-on-the-stage/260766/1 "2008-05-19T18:18:58Z")

</div>

I loaded a movie clip like this:  
// load Home Movie  
var loader:Loader = new Loader();  
var request:URLRequest = new URLRequest(“home.swf”);  
loader.load(request);  
// use addChild() to use your movieclip as the Loader object’s container:  
container.addChild(loader);

Now, I want to tell that movie clip to do something so I put this:  
// play the closing section of the MC inside of the container  
container.gotoAndPlay(“closing”);

And, of course it didn’t work in actionscript 3!!!

Any ideas?  
Ⓜ

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [May 19, 2008, 8:13pm UTC](https://forum.kirupa.com/t/controlling-movie-clips-on-the-stage/260766/2 "2008-05-19T20:13:50Z")

</div>

I’m a noob, so apologies in advance if this doesn’t work, but your question prompted me to read a chapter in a book that I’ve been meaning to get to grips with, and it seems to work OK.

Try this:

```auto
stop();

import flash.display.*;

var loader:Loader = new Loader();
var request:URLRequest = new URLRequest("home.swf");
loader.load(request);

// when the swf has finished loading, we want to run the 'swfLoaded' function
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,swfLoaded);

// this runs when the swf has finished loading
function swfLoaded(myEvent:Event):void
{
    // put the swf on the stage
    stage.addChild(loader);
    
    // create a movie clip we can control
    var myContent:MovieClip = myEvent.target.content;

    // play the bit you want
    myContent.gotoAndStop("closing");
    
    // change the swf's position (but only if you want to ...)
    myContent.x = 120;
    myContent.y = 90;
}

```

Like I say, I’m a noob, so there may be a more elegant way to do this.
