# Variable Help

**URL:** <https://forum.kirupa.com/t/variable-help/311459>\
**Category:** Uncategorized\
**Created:** [July 7, 2010, 5:02am UTC](https://forum.kirupa.com/t/variable-help/311459 "2010-07-07T05:02:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xFlashStudentx](https://avatars.discourse-cdn.com/v4/letter/x/57b2e6/32.png) [@xFlashStudentx](https://forum.kirupa.com/u/xFlashStudentx)\
**Post date:** [July 7, 2010, 5:02am UTC](https://forum.kirupa.com/t/variable-help/311459/1 "2010-07-07T05:02:51Z")

</div>

I have four sets of images which I’m trying to display from different functions (as the code below hopefully illustrates).

More clearly though, I need help writing the variables/code that will hide the sets of images that are currently being displayed. Here’s my starting code to get a better idea:

import com.greensock._;  
import com.greensock.easing._;  
import com.greensock.plugins.\*;

white.addEventListener(MouseEvent.CLICK,changeImages,false,0,true);  
black.addEventListener(MouseEvent.CLICK,changeImages,false,0,true);  
red.addEventListener(MouseEvent.CLICK,changeImages,false,0,true);  
green.addEventListener(MouseEvent.CLICK,changeImages,false,0,true);

white.buttonMode=true;  
black.buttonMode=true;  
red.buttonMode=true;  
green.buttonMode=true;

var currentGallery:_;  
var nextGallery:_;

function showWhite(event:MouseEvent):void  
{  
if(currentGallery!=white)  
{  
currentGallery=white;

```
TweenMax.to(white1, 1.5, {delay:0.2,y:24.95,ease:Quart.easeInOut});
TweenMax.to(white2, 1.5, {delay:0.6,y:13.50, ease:Quart.easeInOut});
TweenMax.to(white3, 1.5, {delay:0.4,y:4.45, ease:Quart.easeInOut});
TweenMax.to(white4, 1.5, {delay:0.8,y:17.50, ease:Quart.easeInOut});
TweenMax.to(white5, 1.5, {delay:1.0,y:24.95, ease:Quart.easeInOut});
hideCurrent();
}
}

```

function showBlack(event:MouseEvent):void  
{  
if(currentGallery!=black)  
{  
currentGallery=black;

```
TweenMax.to(black1, 1.5, {delay:0.2,y:22.15,ease:Quart.easeInOut});
TweenMax.to(black2, 1.5, {delay:0.6,y:-6.10, ease:Quart.easeInOut});
TweenMax.to(black3, 1.5, {delay:0.4,y:-25.95, ease:Quart.easeInOut});
TweenMax.to(black4, 1.5, {delay:0.8,y:32.70, ease:Quart.easeInOut});
TweenMax.to(black5, 1.5, {delay:1.0,y:16.65, ease:Quart.easeInOut});
hideCurrent();
}
}

```

function showRed(event:MouseEvent):void  
{  
if(currentGallery!=red)  
{  
currentGallery=red;

```
TweenMax.to(black1, 1.5, {delay:0.2,y:22.15,ease:Quart.easeInOut});
TweenMax.to(black2, 1.5, {delay:0.6,y:-6.10, ease:Quart.easeInOut});
TweenMax.to(black3, 1.5, {delay:0.4,y:-25.95, ease:Quart.easeInOut});
TweenMax.to(black4, 1.5, {delay:0.8,y:32.70, ease:Quart.easeInOut});
TweenMax.to(black5, 1.5, {delay:1.0,y:16.65, ease:Quart.easeInOut});
hideCurrent();

```

}  
}

function showGreen(event:MouseEvent):void  
{  
if(currentGallery!=green)  
{  
currentGallery=green;

```
TweenMax.to(green1, 1.5, {delay:0.2,y:22.15,ease:Quart.easeInOut});
TweenMax.to(green2, 1.5, {delay:0.6,y:-6.10, ease:Quart.easeInOut});
TweenMax.to(green3, 1.5, {delay:0.4,y:-25.95, ease:Quart.easeInOut});
TweenMax.to(green4, 1.5, {delay:0.8,y:32.70, ease:Quart.easeInOut});
TweenMax.to(green5, 1.5, {delay:1.0,y:16.65, ease:Quart.easeInOut});
hideCurrent();

```

}  
}

function hideWhite():void  
{  
TweenMax.to(white1, 1.5, {delay:0.6,y:630, ease:Back.easeInOut});  
TweenMax.to(white2, 1.5, {delay:0.4,y:630, ease:Back.easeInOut});  
TweenMax.to(white3, 1.5, {delay:0.8,y:630, ease:Back.easeInOut});  
TweenMax.to(white4, 1.5, {delay:0.2,y:630, ease:Back.easeInOut});  
TweenMax.to(white5, 1.5, {delay:1.0,y:630, ease:Back.easeInOut});

}

function hideBlack():void  
{  
TweenMax.to(black1, 1.5, {delay:0.6,y:630, ease:Back.easeInOut});  
TweenMax.to(black2, 1.5, {delay:0.4,y:630, ease:Back.easeInOut});  
TweenMax.to(black3, 1.5, {delay:0.8,y:630, ease:Back.easeInOut});  
TweenMax.to(black4, 1.5, {delay:0.2,y:630, ease:Back.easeInOut});  
TweenMax.to(black5, 1.5, {delay:1.0,y:630, ease:Back.easeInOut});

}

function hideRed():void  
{  
TweenMax.to(black1, 1.5, {delay:0.6,y:630, ease:Back.easeInOut});  
TweenMax.to(black2, 1.5, {delay:0.4,y:630, ease:Back.easeInOut});  
TweenMax.to(black3, 1.5, {delay:0.8,y:630, ease:Back.easeInOut});  
TweenMax.to(black4, 1.5, {delay:0.2,y:630, ease:Back.easeInOut});  
TweenMax.to(black5, 1.5, {delay:1.0,y:630, ease:Back.easeInOut});

}

function hideGreen():void  
{  
TweenMax.to(green1, 1.5, {delay:0.6,y:630, ease:Back.easeInOut});  
TweenMax.to(green2, 1.5, {delay:0.4,y:630, ease:Back.easeInOut});  
TweenMax.to(green3, 1.5, {delay:0.8,y:630, ease:Back.easeInOut});  
TweenMax.to(green4, 1.5, {delay:0.2,y:630, ease:Back.easeInOut});  
TweenMax.to(green5, 1.5, {delay:1.0,y:630, ease:Back.easeInOut});

}

function changeImages(event:MouseEvent):void  
{  
switch(event.target)  
{  
case “white” :  
showWhite();  
hideCurrent();  
break;

```
    case "black" :
    showBlack();
    hideCurrent();
    break;
    
    case "green" :
    showGreen();
    hideCurrent();
    break;
    
    case "red" :
    showRed();
    hideCurrent();
    break;
    
}
    }

// here is where I'm stuck. I need help with the code that will hide the current gallery, or, the code that would 

```

call the apppropriate function. Thus, if someone clicks the red button to see the red gallery, I need the code that will

hide whatever gallery is being displayed.

```
function hideCurrent():void
{
    
}

```

Here’s a link to an example of what I’m trying to do in ActionScript 3, although it’s showing different text. If you go here

> **[Consulting Website Template #29065](https://www.templatemonster.com/website-templates/29065.html)**
>
> 【Consulting Website template #29065】 - enjoy clean, professional and straightforward... ✅【Before You Buy】 - learn technical specifications, read reviews, ask a question.... ✅【Quality Control】 - this premium Website template has passed QC by...

and click the small circle-buttons on the right, you will see different text showing, depending on what button you clicked. After you click a button to see the text, the text that is there moves out.

Hopefully I’m explaining this clearly. Please provide some assistance anyone. Thanks for reading…

Flash Student
