Right, I have this code and it works perfectly fine but I can imagine it could be a lot compacter. The thing my code does is adds 12 movieclips on the stage with a for loop and when you click on one of the movieclip it traces which mc you clicked and gives two variables numbers. The numbers depend on the the clicked mc, the numbers are not related to each other . I made a switch function but maybe there is a cleaner solution. Does any of you have an idea?
public function makeBreadCrumbs() {
for (var i:Number = 0;i <12; i++){
spore = new myFooter()
addChild(spore)
spore.x = 50+spore.width * i
spore.y = 200
spore.Step_text.text = "Step " + (i +1)
spore.Step_text.mouseEnabled = false
spore.name = "Step" + i
spore.buttonMode = true
crumbHeight = spore.height
crumbsArray.push (spore);
spore.addEventListener( MouseEvent.CLICK, onMenuItemClick );
spore.addEventListener( MouseEvent.MOUSE_OVER, crumbsMouseOver);
spore.addEventListener( MouseEvent.MOUSE_OUT, crumbsMouseOut);
}
}
public function onMenuItemClick(evt:MouseEvent):void{
trace ("clicked item " + evt.target.name)
evt.target.addChild (pointer)
pointer.mouseEnabled = false
pointer.y = -crumbHeight/2
switch (evt.target.name){
case "Step0":
xPosition = 10
yPosition = 10
break;
case "Step1":
xPosition = 35
yPosition = 20
break;
case "Step2":
xPosition = 302
yPosition = 30
break;
case "Step3":
xPosition = 500
yPosition = 40
break;
case "Step4":
xPosition = 50
yPosition = 50
break;
case "Step5":
xPosition = 150
yPosition = 60
break;
case "Step6":
xPosition = 70
yPosition = 75
break;
case "Step7":
xPosition = 220
yPosition = 130
break;
case "Step8":
xPosition = 90
yPosition = 90
break;
case "Step9":
xPosition = 103
yPosition = 100
break;
case "Step10":
xPosition = 15
yPosition = 110
break;
case "Step11":
xPosition = -200
yPosition = 120
break;
}
changeMountainPosition()
}