Configure AS3 dropdown into existing project
I have a project which was completed, now I need to add a dropdown menu but how do I impliment the code into the existing actionscript I have?
ACTIONSCRIPT / CURRENT
var Xpos:Number = 0;
var Ypos:Number = 0;
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Btns Universal function
function btnClick(event:MouseEvent):void {
SoundMixer.stopAll();
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
}
// Btn listeners
home.addEventListener(MouseEvent.CLICK, btnClick);
commercial.addEventListener(MouseEvent.CLICK, btnClick);
films.addEventListener(MouseEvent.CLICK, btnClick);
videomontage.addEventListener(MouseEvent.CLICK, btnClick);
contact.addEventListener(MouseEvent.CLICK, btnClick);
ACTIONSCRIPT FOR DROPDOWN
menu.heading.myText.text = "Websites";
menu.panel.b1.myText.text = "Amazon";
menu.panel.b2.myText.text = "Google";
menu.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
if(event.target == menu.panel.b1) {
navigateToURL(new URLRequest("http://www.amazon.com"));
}
if(event.target == menu.panel.b2) {
navigateToURL(new URLRequest("http://www.google.com"));
}
}
????