# \[AS2\]\[CS3\]Help getting variable to store text

**URL:** <https://forum.kirupa.com/t/as2-cs3-help-getting-variable-to-store-text/282801>\
**Category:** flash\
**Created:** [February 26, 2009, 4:56pm UTC](https://forum.kirupa.com/t/as2-cs3-help-getting-variable-to-store-text/282801 "2009-02-26T16:56:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![w4mb6800](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@w4mb6800](https://forum.kirupa.com/u/w4mb6800)\
**Post date:** [February 26, 2009, 4:56pm UTC](https://forum.kirupa.com/t/as2-cs3-help-getting-variable-to-store-text/282801/1 "2009-02-26T16:56:17Z")

</div>

Okay so I’m working on this website where theres a bunch of embedded movie clips in once frame and each one pops up when you click on the btn (also a movie clip but given extension of btn for easy reference). Each smaller movie clip pops up in a different portion of the screen so the close button (solutionClose\_mc) moves wherever. This all worked well and good until they wanted me to put in a link from one movie clip to another one of the other movie clips. Now I had to add another clip (premLink\_mc) to try to link from the premTrack\_mc to prem\_mc. I’ve tried what feels like 100 different variations to make it work and I’m stuck. The conclusion I’ve come to is that the variable isn’t holding the string correctly or for some reason or another the if statement isn’t registering it correctly? This is the code:

```auto

var currentPage:String;
 
function animateOn(service:String) {
            eval(service).gotoAndPlay("down");
}
 
function animateOff(service:String) {
            eval(service).gotoAndPlay("out");
}
 
overview_btn.onRelease = function() {
            if (currentPage != "overview_mc") {
                        animateOn("overview_mc");
                        solutionsClose_mc._x = "-216.1";
                        solutionsClose_mc._y = "278.8";
                        solutionsClose_mc.gotoAndPlay("stop");
                        currentPage = "overview_mc";
            }
};
prem_btn.onRelease = function() {
            if (currentPage != "prem_mc") {
                        animateOn("prem_mc");
                        solutionsClose_mc._x = "-226.1";
                        solutionsClose_mc._y = "208.9";
                        solutionsClose_mc.gotoAndPlay("stop");
                        currentPage = "prem_mc";
            }
};
premTrack_btn.onRelease = function() {
            if (currentPage != "premTrack_mc") {
                        animateOn("premTrack_mc");
                        solutionsClose_mc._x = "-212.1";
                        solutionsClose_mc._y = "-5";
                        solutionsClose_mc.gotoAndPlay("stop");
                        premLink_mc._x = "-67";
                        premLink_mc._y = "-44.1";
                        premLink_mc.gotoAndPlay("stop");
                        currentPage = "premTrack_mc";
            }
};
base_btn.onRelease = function() {
            if (currentPage != "base_mc") {
                        animateOn("base_mc");
                        solutionsClose_mc._x = "-215.6";
                        solutionsClose_mc._y = "22.8";
                        solutionsClose_mc.gotoAndPlay("stop");
                        currentPage = "base_mc";
            }
};
 
solutionsClose_mc.onRelease = function() {
            if (currentPage != "prem_link") {
                        animateOff(currentPage);
                        solutionsClose_mc.gotoAndPlay("start");
                        currentPage = "solutionsClose_mc";
            }
            else {
                        animateOff("prem_mc");
                        premLink_mc.gotoAndPlay("start");
                        solutionsClose_mc.gotoAndPlay("start");
                        currentPage = "solutionsClose_mc";
            }
};
 
premLink_mc.onRelease = function () {
            soltuionsClose_mc.gotoAndPlay("start");
            premLink_mc.gotoAndPlay("start");
            animateOff(currentPage);
            animateOn("prem_mc");
            solutionsClose_mc.gotoAndPlay("stop");
            solutionsClose_mc._x = "-226.1";
            solutionsClose_mc._y = "208.9";
            currentPage = "prem_link";
};
 
button3_mc.onRelease = function() {
            if (currentPage != "overview_mc") {
                        animateOn("overview_mc");
                        solutionsClose_mc._x = "-216.1";
                        solutionsClose_mc._y = "278.8";
                        solutionsClose_mc.gotoAndPlay("stop");
                        currentPage = "overview_mc";
            }
};

```

Now with this way if you click the premTrack\_mc button it animates in all well and good but when you click the close button it does not animate out the premLink\_mc. So I altered the code as such:

```auto

solutionsClose_mc.onRelease = function() {
            if (currentPage = "prem_link") {
                        animateOff(currentPage);
                        solutionsClose_mc.gotoAndPlay("start");
                        currentPage = "solutionsClose_mc";
            }
            else if (currentPage = "premTrack_mc"){
                        animateOff(currentPage);
                        premLink_mc.gotoAndPlay("start");
                        solutionsClose_mc.gotoAndPlay("start");
                        currentPage = "solutionsClose_mc";
            }
            else {
                        animateOff(currentPage);
                        solutionsClose_mc.gotoAndPlay("start");
                        currentPage = "solutionsClose_mc";
            }
};

```

This is where everything went crazy. Now nothing is working. So I’m thinking that my variable isn’t holding the string? Anyone have any thoughts? Thanks in advance.
