# onUnload / onLoad question with code

**URL:** <https://forum.kirupa.com/t/onunload-onload-question-with-code/114589>\
**Category:** Uncategorized\
**Created:** [June 29, 2004, 10:34pm UTC](https://forum.kirupa.com/t/onunload-onload-question-with-code/114589 "2004-06-29T22:34:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmumm](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@jmumm](https://forum.kirupa.com/u/jmumm)\
**Post date:** [June 29, 2004, 10:34pm UTC](https://forum.kirupa.com/t/onunload-onload-question-with-code/114589/1 "2004-06-29T22:34:05Z")

</div>

Why doesn’t this work?

```auto

staticGraphic_mc._visible = false;
contents_mc.loadMovie("main.swf");
main_btn.onRelease = function() {
	contents_mc.play();
	contents_mc.onEnterFrame = function() {
		if (contents_mc._currentframe == contents_mc._totalframes) {
			contents_mc.unloadMovie();
			contents_mc.onUnload = function() {
				trace("asdf");
				staticGraphic_mc._visible = true;
				this.loadMovie("main.swf");
			};
		}
		contents_mc.onLoad = function() {
			trace("fdsa");
			staticGraphic_mc._visible = false;
		};
	};
};

```

Where it traces “asdf” it works fine but where it doesn’t trace “fdsa”. I don’t know whats wron’g
