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]