MovieClipLoader in an object

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?

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.

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)

Got it to work:

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


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 :slight_smile: 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!

yeah, I figured as much :wink:

glad you got it working :slight_smile: