# Using a container or something to shortenen my functions?

**URL:** <https://forum.kirupa.com/t/using-a-container-or-something-to-shortenen-my-functions/321855>\
**Category:** flash\
**Created:** [May 3, 2011, 1:24pm UTC](https://forum.kirupa.com/t/using-a-container-or-something-to-shortenen-my-functions/321855 "2011-05-03T13:24:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![8BitBoyx](https://avatars.discourse-cdn.com/v4/letter/8/8c91f0/32.png) [@8BitBoyx](https://forum.kirupa.com/u/8BitBoyx)\
**Post date:** [May 3, 2011, 1:24pm UTC](https://forum.kirupa.com/t/using-a-container-or-something-to-shortenen-my-functions/321855/1 "2011-05-03T13:24:43Z")

</div>

Hi I need to make a project for school where as I click on a appartment it shows the floorplan of that building.

something like this [http://dl.dropbox.com/u/11355063/test.swf](http://dl.dropbox.com/u/11355063/test.swf)

Now I need to click on each separate part of that floorplan so that a gallery(xml) pops up and some text next aside to it. Make buttons underneath every part of the floorplan? But that are problems for later…

any idea how I can cut this code down to less lines?

I could give parameters to one function? But I don’t know how.

```auto

import com.greensock.TweenLite;
import com.greensock.TweenMax;
import com.greensock.easing.*;
import com.greensock.plugins.TweenPlugin; 
import com.greensock.plugins.VisiblePlugin; 
TweenPlugin.activate([VisiblePlugin])

var plattegrond1Mc:Plattegrond1 = new Plattegrond1();
var plattegrond2Mc:Plattegrond2 = new Plattegrond2();
var plattegrond3Mc:Plattegrond3 = new Plattegrond3();

addChild(plattegrond1Mc);
addChild(plattegrond2Mc);
addChild(plattegrond3Mc);

plattegrond1Mc.visible = false;
plattegrond2Mc.visible = false;
plattegrond3Mc.visible = false;

app1Btn.addEventListener(MouseEvent.CLICK, app1ClickHandler);
app2Btn.addEventListener(MouseEvent.CLICK, app2ClickHandler);
app3Btn.addEventListener(MouseEvent.CLICK, app3ClickHandler);

function app1ClickHandler(e:MouseEvent):void {
	TweenMax.fromTo(plattegrond1Mc, 2, {x:620, y:240, alpha:0}, {x:220, y:200, alpha:1});
	plattegrond1Mc.visible = true;
	plattegrond2Mc.visible = false;
	plattegrond3Mc.visible = false;
}

function app2ClickHandler(e:MouseEvent):void {
	TweenMax.fromTo(plattegrond2Mc, 2, {x:620, y:180, alpha:0}, {x:220, y:200, alpha:1});
	plattegrond1Mc.visible = false;
	plattegrond2Mc.visible = true;
	plattegrond3Mc.visible = false;
}

function app3ClickHandler(e:MouseEvent):void {
	TweenMax.fromTo(plattegrond3Mc, 2, {x:620, y:120, alpha:0}, {x:220, y:200, alpha:1});
	plattegrond1Mc.visible = false;
	plattegrond2Mc.visible = false;
	plattegrond3Mc.visible = true;
}

```
