i want to ask about this code..
if (objek.dropTarget.parent.name == "book")
{
if ((objek == alif) || (objek == ba)){ //yg perlu diganti
//if (objek == objBenar){ //yg perlu diganti
objek.x = objek.dropTarget.parent.x;
objek.y = objek.dropTarget.parent.y + 50;
objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
objek.buttonMode = false;
var _loc_2:Number;
objek.scaleY = 0.4;
objek.scaleX = _loc_2;
objek.alpha = 0.6;
score+=5;
scorebox.text = "Score: " + score;
}
else {
objek.x = objek.dropTarget.parent.x;
objek.y = objek.dropTarget.parent.y + 50;
objek.removeEventListener(MouseEvent.MOUSE_DOWN, down);
objek.buttonMode = false;
var _loc_2:Number;
objek.scaleY = 0.4;
objek.scaleX = _loc_2;
objek.alpha = 0.6;
score-=2;
scorebox.text = "Score: " + score;}
}
}
i have movieclip alif, ba, and dal..this three can be dragged to movieclip named "book" and the score will change. if i drag alif and ba movieclip to book, score will increase.. if i drag dal movieclip to book score will decrease.. how if i want to make the movieclip alif and ba of an array??and how to write the condition?? help pliss :(
I'm not sure if I understand, but do you want to have an array containing alif and ba and then check if the movieclip is in that array? This is how you would do that:
var scoreIncreasers:Array = [alif, ba];
var isScoreIncreaser:Boolean = (scoreIncreasers.indexOf(objeck) !== -1);
if(isScoreIncreaser) {
// Increase score
}
Edit:
Based on your comment, I think this is what you want:
var objBener:Array = [alif, ba];
if(objBener.indexOf(objek) !== -1) {
//yg perlu diganti
}