# Redefine a function

**URL:** <https://forum.kirupa.com/t/redefine-a-function/306645>\
**Category:** flash\
**Created:** [March 18, 2010, 11:44pm UTC](https://forum.kirupa.com/t/redefine-a-function/306645 "2010-03-18T23:44:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hausnfranz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hausnfranz/32/2427_2.png) [@Hausnfranz](https://forum.kirupa.com/u/Hausnfranz)\
**Post date:** [March 18, 2010, 11:44pm UTC](https://forum.kirupa.com/t/redefine-a-function/306645/1 "2010-03-18T23:44:48Z")

</div>

I would like to redefine the information within moveHighlight once I go to another frame, and was wondering how to do this with as3. I want to leave all the if statements alone, I just need to change the variables.

This code needs to be really basic, so I can’t use classes or anthing like that.

```auto

function moveHighlight(event:Event = null) {

    if (highlightedButton == btn0) {
        if (moveUp == true) {
            trace("moveUp");
            highlightedButton.gotoAndPlay("rest");
            highlightedButton = btn3;
            targetPage = "page3";
            highlightedButton.gotoAndPlay("highlight");
            moveUp = false;
        }
        if (moveRight == true) {
            trace("moveRight");
            highlightedButton.gotoAndPlay("rest");
            highlightedButton = btn1;
            targetPage = "page2";
            highlightedButton.gotoAndPlay("highlight");
            moveRight = false;
        }
        if (moveDown == true) {
            trace("moveDown");
            highlightedButton.gotoAndPlay("rest");
            highlightedButton = btn1;
            targetPage = "page2";
            highlightedButton.gotoAndPlay("highlight");
            moveDown = false;
        }
        if (moveLeft == true) {
            trace("moveLeft");
            highlightedButton.gotoAndPlay("rest");
            highlightedButton = btn3;
            targetPage = "page3";
            highlightedButton.gotoAndPlay("highlight");
            moveLeft = false;
        }
        if (moveSelect == true) {
            trace("moveSelect");
            targetPage = "page2"
            highlightedButton.gotoAndPlay("rest");
            this.gotoAndStop(targetPage);
            //highlightedButton = btn0;
            //highlightedButton.gotoAndPlay("highlight");
            moveSelect = false;
        }
        if (moveConfirm == true) {
            trace("moveConfirm");
            this.gotoAndStop("page2");
            //highlightedButton.gotoAndPlay("rest");
            //highlightedButton = btn1;
            //highlightedButton.gotoAndPlay("highlight");
            moveConfirm = false;
        }
        if (moveBack == true) {
            trace("moveBack");
            this.gotoAndStop("page0");
            //highlightedButton.gotoAndPlay("rest");
            //highlightedButton = btn1;
            //highlightedButton.gotoAndPlay("highlight");
            moveBack = false;
        }
    }
}
    

```
