I am trying to learn AS3 and have been working through a tutorial. It is basically a photo gallery, that when you click a thumbnail it loads a large image. I have now decided to try and adapt it and learn more AS3 at the same time. Basically I would like to load a SWF instead of a large image. The problem I have run into, is that I can’t figure out how to close the loaded MC once you are done view it. I have a close button in the loaded MC, but I can’t seem to get it to send the right info in order to call a function in the parent MCs timeline. Below is just some partial code.
Function in loaded MC:
function closeMe(e:MouseEvent):void
{
var mc_container:MovieClip = MovieClip(this.parent.parent.parent);
mc_container.removeFull(e);
}
Function on parent main timeline:
function removeFull(e:MouseEvent):void{
var my_loader:Loader = Loader (e.currentTarget);
full_tween = new Tween(my_loader, “alpha”, Strong.easeOut, 1,0,0.5, true);
full_tween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinished);
container_mc_tween = new Tween(container_mc, "alpha", Strong.easeOut, 0.5,1,0.5, true)
}
This is the error I see in the output window:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@469acf81 to flash.display.Loader.
at gallery_fla::MainTimeline/removeFull()
at tester_fla::MainTimeline/closeMe()
I’m guessing the problem is that I need to figure out a way to pass the mouse click on my close button, to the removeFull function on my main timeline.
Any help would be greatly appreciated.
Thanks