# How can I retrieve a swf's name?

**URL:** <https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387>\
**Category:** flash\
**Created:** [April 27, 2003, 3:10pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387 "2003-04-27T15:10:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sansa99](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sansa99](https://forum.kirupa.com/u/sansa99)\
**Post date:** [April 27, 2003, 3:10pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/1 "2003-04-27T15:10:55Z")

</div>

Hello everybodys 🙂 !

This question is probably more theoretical than practical, though there may be uses for figuring out how to do this.

If I set up a small dynamic text box (var ‘disp’) on the main stage and then script on a movieclip: onClipEvent(enterFrame){\_root.disp = this.\_name} I will get the name of the movieClip, correct?

I have been trying to get a swf to state what it’s name is, ie: if a swf called movie1.swf is playing, how can you extract that data? I tried scripting on a movieClip: onClipEvent(enterFrame){\_root.disp = \_root.\_name}, but nothing happened of course lol. Maybe it is not possible to do this.

Thanx in advance for any insights anyone might have on this 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 27, 2003, 3:18pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/2 "2003-04-27T15:18:53Z")

</div>

\_url

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 27, 2003, 3:31pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/3 "2003-04-27T15:31:34Z")

</div>

```auto
onClipEvent(enterFrame){
    _root.disp = this._name
}

```

will return the instance name of MC, not the actual name. if you want to get the actual name you might have to use [COLOR=crimson]this.\_url[/COLOR] because that will get the full url of the movie, including movie.swf.

However you will also get the rest of the stuff like [http://www.domain.com/](http://www.domain.com/)… There is a way to remove all the rest of the crap if, you tell the variable to cut the string where the [domain.com](http://domain.com)… is.

Like if your \_url is [COLOR=crimson][http://www.domain.com/flash/movie1.swf[/COLOR]](http://www.domain.com/flash/movie1.swf%5B/COLOR%5D) then you can go [COLOR=crimson]myVariable = \_url.subString(27)[/COLOR] that will take what ever is 27 characters until the end of the string and store it in myVariable.

Thats the only way I can think to do it, With out writing a complex function.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 27, 2003, 4:26pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/4 "2003-04-27T16:26:21Z")

</div>

\_url.substr(\_url.lastIndexOf("/")+1)  
🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 27, 2003, 5:44pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/5 "2003-04-27T17:44:05Z")

</div>

that’s pretty sweet, much better than mine, 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 27, 2003, 6:51pm UTC](https://forum.kirupa.com/t/how-can-i-retrieve-a-swfs-name/19387/6 "2003-04-27T18:51:10Z")

</div>

Thank you so much Senocular and Iamapathy.

I tried it out right away and it works perfectly - brilliant!

Much appreciated, bye for now 🙂 !
