# Frame number of external SWF

**URL:** <https://forum.kirupa.com/t/frame-number-of-external-swf/262217>\
**Category:** Uncategorized\
**Created:** [June 4, 2008, 7:16am UTC](https://forum.kirupa.com/t/frame-number-of-external-swf/262217 "2008-06-04T07:16:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![incubo80](https://avatars.discourse-cdn.com/v4/letter/i/8797f3/32.png) [@incubo80](https://forum.kirupa.com/u/incubo80)\
**Post date:** [June 4, 2008, 7:16am UTC](https://forum.kirupa.com/t/frame-number-of-external-swf/262217/1 "2008-06-04T07:16:43Z")

</div>

Hi, here’s a question from a designer, not a programmer – accept my apologies if it is obvious (hopefully it is!)

If I open an external swf-file, how can I tell it to go straight to frame 8?

```auto
var loader:Loader;
var container:MovieClip;
loader = new Loader();
container = new MovieClip();

var SWF:URLRequest = new URLRequest("name.swf");

btn.addEventListener(MouseEvent.CLICK, loadSWF, false, 0, true);

//I assume it has to go somewhere here:

function loadSWF(e:MouseEvent): void {
    loader.load(SWF);
    this.addChild(container);
    container.addChild(loader);
}

```

There’s more code with the receiver and localConnection, but I think that’s not relevant for this question, right?

Thanks for your help

---

<div class="post-metadata">

**Author:** ![Fidodo](https://avatars.discourse-cdn.com/v4/letter/f/779978/32.png) [@Fidodo](https://forum.kirupa.com/u/Fidodo)\
**Post date:** [June 4, 2008, 9:39am UTC](https://forum.kirupa.com/t/frame-number-of-external-swf/262217/2 "2008-06-04T09:39:40Z")

</div>

When loader completes loading it runs an INIT event

which is in the package flash.events.Event

Add the listener:

loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);

This will execute when the swf is fully loaded so you can safely access it. Otherwise you might try to access something in the swf that hasn’t loaded yet and you’d get a null property error. You can do whatever you want in the initHandler function.

---

<div class="post-metadata">

**Author:** ![incubo80](https://avatars.discourse-cdn.com/v4/letter/i/8797f3/32.png) [@incubo80](https://forum.kirupa.com/u/incubo80)\
**Post date:** [June 4, 2008, 2:14pm UTC](https://forum.kirupa.com/t/frame-number-of-external-swf/262217/3 "2008-06-04T14:14:20Z")

</div>

Please marry me! Thank you so much, I can’t believe I spent two days on that problem and you come up with a solution immediately. Wonderful.
