# MovieClipLoader in an object

**URL:** <https://forum.kirupa.com/t/moviecliploader-in-an-object/60468>\
**Category:** flash\
**Created:** [August 10, 2004, 4:38am UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468 "2004-08-10T04:38:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustin\_c1](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@dustin\_c1](https://forum.kirupa.com/u/dustin_c1)\
**Post date:** [August 10, 2004, 4:38am UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468/1 "2004-08-10T04:38:33Z")

</div>

This is going to be related to the oop post.

For whatever reason, I can’t seem to call [color=darkorange]myMovieClipLoader.(url,target)[/color][color=black] to load a MovieClip from within a method of a custom class. It works fine when I call it in the timeline.[/color]

Is it possible, or are my moviecliploaders going to have to live in the timeline?

---

<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:** [August 10, 2004, 10:02am UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468/2 "2004-08-10T10:02:27Z")

</div>

then it might be a path-related problem.  
perhaps you’re calling it from within an object’s method?

mc.onPress = function() {  
myMovieClipLoader.(url,target);  
}

that won’t work, instead do this:

mc.onPress = function() {  
\_parent.myMovieClipLoader.(url,target);  
}

or in a class:

mc.parent = this;  
mc.onPress = function() {  
parent.myMovieClipLoader.(url,target);  
}

But it might be just as handy to create a new MovieClipLoader, use it, the delete it.

---

<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:** [August 10, 2004, 10:15am UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468/3 "2004-08-10T10:15:33Z")

</div>

like with loadMovie, getting methods like that from MovieClipLoader to work is simply a matter of correct timeline referencing. These objects dont have to be called or be defined in a timeline, they just need to be able to correctly reference what it is they’re operating on, in your case, target. What is target and are you sure its not undefined? … also, ditch the period (.) between myMovieClipLoader and (url,target);

myMovieClipLoader(“url”,target)

---

<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:** [August 10, 2004, 6:47pm UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468/4 "2004-08-10T18:47:38Z")

</div>

Got it to work:

Using your example .fla in the previous post - this works

```php

class MyClass extends MovieClip { 
   var mc_imageContainer:MovieClip;
   var sourceURL:String = "image_url.jpg";
   var mcl_loader:MovieClipLoader;
   var listener:Object;
   function MyClass() {	
	  mcl_loader = new MovieClipLoader();
	  listener = new Object();
	  listener.onLoadComplete = function (target_mc) {
		 trace ("Movie clip = " + target_mc + " has been loaded");
	  }
	  mcl_loader.addListener(listener);
	  mcl_loader.loadClip(sourceURL, mc_imageContainer);
	
   } 
}

```

“also, ditch the period (.) between myMovieClipLoader and (url,target);”

Blech…it was late 🙂 I don’t have problems with simple syntax errors - you can safely ignore those. Any time I make them, they are easily corrected. I meant myMovieClipLoader.loadClip(“url”, target).

Thats a million for your help!

---

<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:** [August 10, 2004, 7:09pm UTC](https://forum.kirupa.com/t/moviecliploader-in-an-object/60468/5 "2004-08-10T19:09:27Z")

</div>

yeah, I figured as much 😉

glad you got it working 🙂
