# Extended movieclip class - moviecliploader troubles

**URL:** <https://forum.kirupa.com/t/extended-movieclip-class-moviecliploader-troubles/198147>\
**Category:** Uncategorized\
**Created:** [August 22, 2006, 7:33pm UTC](https://forum.kirupa.com/t/extended-movieclip-class-moviecliploader-troubles/198147 "2006-08-22T19:33:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lardlad](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lardlad](https://forum.kirupa.com/u/lardlad)\
**Post date:** [August 22, 2006, 7:33pm UTC](https://forum.kirupa.com/t/extended-movieclip-class-moviecliploader-troubles/198147/1 "2006-08-22T19:33:40Z")

</div>

Greetings:

I’ve extended the movieclip class, via the library/attachMovie. I’m also loading images  
into movieclips on the fly, and need onRollover and onRollout functionality. Here’s the  
deal: I can access properties and methods of the extended class just fine outside of  
the listener.onLoadInit function, but can’t access them within:

[FONT=Courier New]var mclListener:Object = new Object();  
var img\_mcl:MovieClipLoader = new MovieClipLoader();  
this.attachMovie(“extend\_mc”, “test\_mc”, this.getNextHighestDepth());  
//ExtendMC is the subclass of MovieClip - makes no difference  
//to pass target\_mc as a MovieClip or an ExtendMC…  
mclListener.onLoadInit = function(target\_mc:ExtendMC):Void {  
target\_mc.onRelease = function() {  
trace(“The on release event worked, however:”);  
trace("Within the listener, the extended movieclip’ test\_str property is "+target\_mc.test\_str);  
target\_mc.test\_fn();  
};  
};  
img\_mcl.addListener(mclListener);  
img\_mcl.loadClip(“lemon2.jpg”, test\_mc);  
trace("Outside of the movieclip loader, test\_str is "+test\_mc.test\_str);  
test\_mc.test\_fn();  
[FONT=Verdana]  
The class looks like:  
[FONT=Courier New]class ExtendMC extends MovieClip {  
public var test\_str:String = “Able to access the test\_str property.”;  
public function test\_fn(Void):Void {  
trace(“Able to access the test\_fn property”);  
}  
public function ExtendMC() {  
// constructor  
}  
}  
[/FONT]  
Any ideas about how to make methods and properties of the ExtendMC class  
visible within the listener functions?

Thanks  
[/FONT][/FONT]
