# \[FMX\] LoadMovie - Can I detect if successful?

**URL:** <https://forum.kirupa.com/t/fmx-loadmovie-can-i-detect-if-successful/11994>\
**Category:** flash\
**Created:** [January 25, 2003, 12:22am UTC](https://forum.kirupa.com/t/fmx-loadmovie-can-i-detect-if-successful/11994 "2003-01-25T00:22:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DJ\_Lex](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@DJ\_Lex](https://forum.kirupa.com/u/DJ_Lex)\
**Post date:** [January 25, 2003, 12:22am UTC](https://forum.kirupa.com/t/fmx-loadmovie-can-i-detect-if-successful/11994/1 "2003-01-25T00:22:46Z")

</div>

I’m using loadmovie and I’d like to be able to detect if it succeeded or failed. If it fails, I’d like to load a different movie.

I haven’t found anything in the AS dictionary so any help on this would be appreciated.

Thanks,  
Lex

---

<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:** [January 25, 2003, 1:26am UTC](https://forum.kirupa.com/t/fmx-loadmovie-can-i-detect-if-successful/11994/2 "2003-01-25T01:26:27Z")

</div>

It can be done (Thanks goes tov FlashGuru for pointing that out) using the following script: 🙂

```php
fileExists = new LoadVars();
fileExists._parent = this;
fileExists.onLoad = function(success) {
    //success is true if the file exists, false if it doesnt
    if (success) {
        //the file exists
        var nm = this._parent.createEmptyMovieClip("swfHolder", 1);
        //so create a movieclip
        nm.loadMovie("myfile.swf");
        //and load our .swf file into it
    } else {
        trace("error");
    }
};
fileExists.load("myfile.swf");
//initiate the test

```

I think that the code is clear enough to be understood, hope it helps.

cheers;
