# MovieClip.onLoad fix

**URL:** <https://forum.kirupa.com/t/movieclip-onload-fix/9472>\
**Category:** classic bestof\
**Created:** [December 12, 2002, 2:01pm UTC](https://forum.kirupa.com/t/movieclip-onload-fix/9472 "2002-12-12T14:01:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![h88](https://avatars.discourse-cdn.com/v4/letter/h/e9bcb4/32.png) [@h88](https://forum.kirupa.com/u/h88)\
**Post date:** [December 12, 2002, 2:01pm UTC](https://forum.kirupa.com/t/movieclip-onload-fix/9472/1 "2002-12-12T14:01:59Z")

</div>

When Loading an swf, and invoking the onLoad handler, it wouldn’t work. However, when using Bokel’s fix, it’d work-out that issue.

[http://chattyfig.figleaf.com/ezmlm/ezmlm-cgi?1:mss:49174](http://chattyfig.figleaf.com/ezmlm/ezmlm-cgi?1:mss:49174)

---

<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:04am UTC](https://forum.kirupa.com/t/movieclip-onload-fix/9472/2 "2003-01-25T01:04:54Z")

</div>

Another clever solution made by FlashGuru which involves loading an swf directly from an instance of the LoadVars Class. However, there are cases, though, for which it returns a 404 error.

```auto
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

```

For more information, see FlashGuru’s article:

[http://www.flashguru.co.uk/000310.php](http://www.flashguru.co.uk/000310.php)

---

<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/movieclip-onload-fix/9472/3 "2003-01-25T01:26:56Z")

</div>

:stunned: :stunned: :stunned:
