# Change picture in banner function, thing a majig

**URL:** https://forum.kirupa.com/t/change-picture-in-banner-function-thing-a-majig/251132
**Category:** Uncategorized
**Created:** [February 5, 2008, 5:42pm UTC](https://forum.kirupa.com/t/change-picture-in-banner-function-thing-a-majig/251132 "2008-02-05T17:42:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)
#### Post date: [February 5, 2008, 5:42pm UTC](https://forum.kirupa.com/t/change-picture-in-banner-function-thing-a-majig/251132/1 "2008-02-05T17:42:24Z")

</div>

So I’m helping a friend, or trying to, who needs me to take an .fla and add the ability to change an image on the main layer when one of the navigation buttons is pressed. Easy enough, but I don’t know CS3 enough to figure out how…I understand classes / functions to a very novice extent. So, any suggestions? Here is my current code, which works, in making the site change pages etc.

```auto

this.menuBox_mc.appetizer_menu_btn.buttonMode = true;   
this.menuBox_mc.lunch_menu_btn.buttonMode = true;   
this.menuBox_mc.dinner_menu_btn.buttonMode = true;   
//this.menuBox_mc.dessert_menu_btn.buttonMode = true;   
this.menuBox_mc.coffee_menu_btn.buttonMode = true; 
this.menuBox_mc.martini_menu_btn.buttonMode = true; 
this.menuBox_mc.martini_menu_btn.useHandCursor = true; 

this.menuBox_mc.home_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.appetizer_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.lunch_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.dinner_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.dessert_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.coffee_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.martini_menu_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.photos_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);
this.menuBox_mc.contact_btn.addEventListener(MouseEvent.MOUSE_DOWN, handleMenuClick);

this.menuBox_mc.menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.appetizer_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.lunch_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.dinner_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.dessert_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.coffee_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);
this.menuBox_mc.martini_menu_btn.addEventListener(MouseEvent.MOUSE_OVER, showMenu);

this.menuBox_mc.menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.appetizer_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.lunch_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.dinner_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.dessert_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.coffee_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.martini_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);
this.menuBox_mc.menu_btn.useHandCursor = false;

this.menuBox_mc.martini_menu_btn.addEventListener(MouseEvent.MOUSE_OUT, hideMenu);

this.subMenu = new Array(this.menuBox_mc.appetizer_menu_btn,
                         this.menuBox_mc.lunch_menu_btn,
                         this.menuBox_mc.dinner_menu_btn,
                         this.menuBox_mc.dessert_menu_btn,
                         this.menuBox_mc.coffee_menu_btn,
                         this.menuBox_mc.martini_menu_btn);

this.subMenuName = new Array( "appetizer",
                                "lunch",
                                 "dinner",
                                 "dessert",
                                "coffee",
                                 "martini");

for(var i = 0; i < this.subMenu.length; i++){
        this.subMenu*.tBlack.text=
        this.subMenu*.tWhite.text=this.subMenuName*;
        this.subMenu*.alpha = 0;
}

this.clipUrls = new Array();
this.clipUrls["home_btn"] = "home.swf";
this.clipUrls["photos_btn"] = "gallery_content.swf";
this.clipUrls["contact_btn"] = "contact.swf";

this.clipUrls["appetizer_menu_btn"] = "menu_appetizer.swf";
this.clipUrls["lunch_menu_btn"] = "menu_lunch.swf";
this.clipUrls["dinner_menu_btn"] = "menu_dinner.swf";
//this.clipUrls["dessert_menu_btn"] = "menu_dessert.swf";
this.clipUrls["coffee_menu_btn"] = "menu_coffees.swf";
this.clipUrls["martini_menu_btn"] = "menu_martini.swf";

function handleMenuClick(e:MouseEvent):void{
    var b = e.target;
    //weirdness---
    if(b.name =="tWhite"){
        b=b.parent;
    }
    
    var m = menuBox_mc;
    if(this.loadingState == "done" || this.loadingState == "fadeIn" || this.loadingState == "expanding" ){
        debug(b.name);
        if( this.clipUrls[b.name] != undefined && this.clipUrls[b.name] != this.nextMovie){
            this.nextMovie =this.clipUrls[b.name];
            fadeOut();        
        }
    }else{
        trace("Wait...: Loading state = " + this.loadingState);
    }
}

function showMenu(e:MouseEvent):void{
    for(var i = 0; i < this.subMenu.length; i++){
        this.subMenu*.alpha=1;
    }
}

function hideMenu(e:MouseEvent):void{
    for(var i = 0; i < this.subMenu.length; i++){
        this.subMenu*.alpha=0;
    }
}

```
