Hi
I’ve got a problem with a menu… On the stage i have 4 movieclips. Each one is an element in the menu. For each movieclip i have a class which contains contents that should be displayed when a movieclip in the menu is clicked. So for so good.
But when i click on another movieclip the class for its contents beeing added over the old one and the old one want be removed. I really need to remove th current displayed class when a new movieclip is clicked.
Some one who can help me? :suppose_maybe:
CODE
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
public class Main extends MovieClip
{
public var portolio:MovieClip;
public var about:MovieClip;
public var clients:MovieClip;
public var contact:MovieClip;
private var _portfolio:Portfolio = new Portfolio();
private var _about:About = new About();
private var _clients:Clients = new Clients();
private var _contact:Contact = new Contact();
private var _menuArr:Array;
public function Main()
{
_menuArr = [];
_menuArr.push(portfolio,about,clients,contact);
portfolio.theContent = _portfolio;
about.theContent = _about;
clients.theContent = _clients;
contact.theContent = _contact;
var menuLen:int = _menuArr.length;
for (var i:int = 0; i < menuLen; i++)
{
_menuArr*.addEventListener(MouseEvent.CLICK, menuClicked);
_menuArr*.buttonMode = true;
_menuArr*.x = 0;
}
}
private function menuClicked(event:Event):void
{
addChild(event.target.theContent);
}
}
}