Using a container or something to shortenen my functions?

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

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.


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;
}