# Condition "if" mistake

**URL:** <https://forum.kirupa.com/t/condition-if-mistake/329724>\
**Category:** Uncategorized\
**Created:** [October 7, 2012, 10:22am UTC](https://forum.kirupa.com/t/condition-if-mistake/329724 "2012-10-07T10:22:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehud](https://avatars.discourse-cdn.com/v4/letter/e/ebca7d/32.png) [@ehud](https://forum.kirupa.com/u/ehud)\
**Post date:** [October 7, 2012, 10:22am UTC](https://forum.kirupa.com/t/condition-if-mistake/329724/1 "2012-10-07T10:22:15Z")

</div>

hi  
attached is a code which contains "if"condition (marked in red).  
however it doesn’t work.  
the trace shows all time x value of 150, even if var hit is "mom, girl or baby.  
please help find the mistake.  
thanks

```
	import flash.display.*;
	import flash.events.*;
	import flash.text.TextField;
//aba1.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
aba2.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
aba3.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
aba4.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
//baby1.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
baby2.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
baby3.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
baby4.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
//girl1.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
girl2.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
girl3.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
girl4.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
//mom1.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
mom2.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
mom3.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
mom4.addEventListener(MouseEvent.MOUSE_DOWN,move_faces);
//aba1.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
aba2.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
aba3.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
aba4.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
//baby1.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
baby2.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
baby3.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
baby4.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
//girl1.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
girl2.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
girl3.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
girl4.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
//mom1.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
mom2.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
mom3.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
mom4.addEventListener(MouseEvent.MOUSE_UP,drop_faces);
var hit;
var placey:Number;

```

function move\_faces(evt:MouseEvent):void{  
var object = evt.target;  
object.startDrag();  
hit=object.name  
trace(hit)  
[COLOR=#ff0000]if (hit==aba2||aba3||aba4){[/COLOR]  
[COLOR=#ff0000] placey=150[/COLOR]  
[COLOR=#ff0000] }[/COLOR]  
[COLOR=#ff0000] else if (hit==mom2||mom3||mom4){[/COLOR]  
[COLOR=#ff0000] placey=383[/COLOR]  
[COLOR=#ff0000] }[/COLOR]  
[COLOR=#ff0000] else if (hit==girl2||girl3||girl4){[/COLOR]  
[COLOR=#ff0000] placey=600[/COLOR]  
[COLOR=#ff0000] }[/COLOR]  
[COLOR=#ff0000] else {[/COLOR]  
[COLOR=#ff0000] placey=820[/COLOR]  
[COLOR=#ff0000] }[/COLOR]  
trace(placey)  
trace(hit)  
}  
function drop\_faces(evt:MouseEvent):void{  
var targets;  
var obj = evt.target;  
obj.stopDrag();  
targets=(obj.dropTarget.parent)  
obj.x=targets.x  
obj.y=targets.y  
if(targets==back){   
trace(targets.name)  
obj.y=placey;  
obj.x=1070;   
}  
}
