I’m having issues figuring out this once simple command. Below is my code, how can i create an unload function that works for all my buttons? I’ve been researching but can’t find something clear enough for me to understand. I feel like there’s an easy fix, but i’m fried from staring at it. Thanks!
var home:Loader = new Loader();
var contact:Loader = new Loader();
var cont:MovieClip = new MovieClip();
//1st button:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
home_btn.addEventListener(MouseEvent.MOUSE_OVER, homeOver);
function homeOver(evt:MouseEvent):void {
home_btn_mc.gotoAndPlay(“on”);
}
home_btn.addEventListener(MouseEvent.CLICK, homeLoad);
function homeLoad(Event: MouseEvent) {
home.load(new URLRequest("home.swf"));
cont.x = 0;
cont.y = 20;
stage.addChild(cont);
cont.addChild(home);
}
home_btn.addEventListener(MouseEvent.MOUSE_OUT, homeOut);
function homeOut(evt:MouseEvent):void {
home_btn_mc.gotoAndPlay(“off”);
}
//2nd button:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
contact_btn.addEventListener(MouseEvent.CLICK, contactLoad);
function contactLoad(Event: MouseEvent) {
contact.load(new URLRequest(“contact.swf”));
cont.x = 0;
cont.y = 20;
stage.addChild(cont);
cont.addChild(contact);
}
contact_btn.addEventListener(MouseEvent.MOUSE_OVER, contactOver);
function contactOver(evt:MouseEvent):void {
contact_btn_mc.gotoAndPlay(“on”);
}
contact_btn.addEventListener(MouseEvent.MOUSE_OUT, contactOut);
function contactOut(evt:MouseEvent):void {
contact_btn_mc.gotoAndPlay(“off”);
}