# Dynamic Loading + Timing

**URL:** <https://forum.kirupa.com/t/dynamic-loading-timing/186617>\
**Category:** flash\
**Created:** [April 22, 2006, 9:54pm UTC](https://forum.kirupa.com/t/dynamic-loading-timing/186617 "2006-04-22T21:54:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zicemaster](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@zicemaster](https://forum.kirupa.com/u/zicemaster)\
**Post date:** [April 22, 2006, 9:54pm UTC](https://forum.kirupa.com/t/dynamic-loading-timing/186617/1 "2006-04-22T21:54:50Z")

</div>

I’m having a few problems with loading swf after swf. I want one swf to load after another has loaded and so on… Down a long chain until everything is loaded.

I know this code doesn’t work… But it shows you what I’m trying to do.

Should I use listeners to achieve this? Because \_root.theMC.onLoad = function(){-Do Stuff-} doesn’t seem to work at all…

```auto

  // Loading the first file.. .This works
 _root.profile.pContent.loadMovie("http://files.hosting.com/files/profile.swf"+noCacheString);
  //This does not work...
 _root.profile.pContent.onLoad = function() {
        _root.background1.loadMovie("http://files.hosting.com/files/background.swf");
    };
//Or this either...
    _root.background1.onLoad = function() {
        _root.curtain.play();
    };

```

---

<div class="post-metadata">

**Author:** ![zicemaster](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@zicemaster](https://forum.kirupa.com/u/zicemaster)\
**Post date:** [April 22, 2006, 10:08pm UTC](https://forum.kirupa.com/t/dynamic-loading-timing/186617/2 "2006-04-22T22:08:34Z")

</div>

Hmmm… Argh… Not working!

```auto

    _root.profile.pContent.onLoadComplete = function(container:MovieClip) {
        _root.background1.loadMovie("http://files.myspace-hosting.com/files/422/background.swf");
    };

```

This doesn’t work right either… I’m tired… Time to take a break.

```php

    myMCL = new MovieClipLoader();
    myListener = new Object();

    myListener.onLoadComplete = function(targetMC) {
            bah = targetMC; // Just a test to see if it's working right.
    };

    myMCL.loadClip("http://files.hosting.com/files/422/background.swf", _root.profile.pContent);
    myMCL.addListener(myListener);

```
