# loadMovie

**URL:** <https://forum.kirupa.com/t/loadmovie/265495>\
**Category:** Uncategorized\
**Created:** [July 9, 2008, 4:03pm UTC](https://forum.kirupa.com/t/loadmovie/265495 "2008-07-09T16:03:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeventKA](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leventka/32/2160_2.png) [@LeventKA](https://forum.kirupa.com/u/LeventKA)\
**Post date:** [July 9, 2008, 4:03pm UTC](https://forum.kirupa.com/t/loadmovie/265495/1 "2008-07-09T16:03:09Z")

</div>

I have a.swf (2 frame) and b.swf(10 frame as animation).

On A’s 1.frame, A loads B and B plays.  
I want, when \*\*B finished (on B’s last frame), B makes that A will goto 2.frame

Like: \*\*_MovieClip(root).gotoAndStop(3);_

---

<div class="post-metadata">

**Author:** ![jsn\_greenbag](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jsn\_greenbag](https://forum.kirupa.com/u/jsn_greenbag)\
**Post date:** [July 9, 2008, 8:05pm UTC](https://forum.kirupa.com/t/loadmovie/265495/2 "2008-07-09T20:05:12Z")

</div>

dispatch an event on frame ten in b.swf and listen to it in a.swf

```auto

//frame 10, b.swf
dispatchEvent(new Event("COMPLETE"));

```

```auto

//frame 1, a.swf
b.addEventListener("COMPLETE", onComplete);

function onComplete( e:Event ):void
{
   gotoAndStop(2);
}

```

just make sure you set the listener after b.swf has completely loaded into a.swf.

---

<div class="post-metadata">

**Author:** ![LeventKA](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leventka/32/2160_2.png) [@LeventKA](https://forum.kirupa.com/u/LeventKA)\
**Post date:** [July 9, 2008, 8:33pm UTC](https://forum.kirupa.com/t/loadmovie/265495/3 "2008-07-09T20:33:20Z")

</div>

I did you said  
but didnt worked

```auto
var ldr:Loader = new Loader();
var url:String = "http://127.0.0.1/test.swf";
var urlReq:URLRequest = new URLRequest(url);

trace("first");
ldr.load(urlReq);
box.addChild(ldr);

ldr.addEventListener("COMPLETE", onComplete);

function onComplete( e:Event ):void{
  trace("ok");
}

```

---

<div class="post-metadata">

**Author:** ![jsn\_greenbag](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jsn\_greenbag](https://forum.kirupa.com/u/jsn_greenbag)\
**Post date:** [July 10, 2008, 8:35am UTC](https://forum.kirupa.com/t/loadmovie/265495/4 "2008-07-10T08:35:10Z")

</div>

hey, sorry should’ve been more clear…

you need to set the listener to the loaded content when it’s loaded - not on the loader.

so, first you need to listen to the loader to know when the swf has been loaded.

```auto

ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);

```

when the swf has loaded you can add the listener to it.

```auto

function onLoadComplete(e:Event):void
{
   e.target.content.addEventListener("COMPLETE", onComplete);
}

```

---

<div class="post-metadata">

**Author:** ![LeventKA](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leventka/32/2160_2.png) [@LeventKA](https://forum.kirupa.com/u/LeventKA)\
**Post date:** [July 10, 2008, 9:25am UTC](https://forum.kirupa.com/t/loadmovie/265495/5 "2008-07-10T09:25:28Z")

</div>

Worked Successfully, viele danke!!
