# Check if answer is correct...If?

**URL:** <https://forum.kirupa.com/t/check-if-answer-is-correct-if/77357>\
**Category:** flash\
**Created:** [January 26, 2005, 6:52pm UTC](https://forum.kirupa.com/t/check-if-answer-is-correct-if/77357 "2005-01-26T18:52:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossarian](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yossarian](https://forum.kirupa.com/u/yossarian)\
**Post date:** [January 26, 2005, 6:52pm UTC](https://forum.kirupa.com/t/check-if-answer-is-correct-if/77357/1 "2005-01-26T18:52:18Z")

</div>

Had some help compiling the AS for a basic drag and drop game where users drag a dynamically loaded txt onto a series of MC. Does anyone know how I can have a Check Answer button for this?

this is the code:

```auto

// ************************
var str:String = "my cash";
var strSplit:Array = str.split ("");
for (var i = 0; i < strSplit.length; i++) {
	if (strSplit* != ' ') {
		this.attachMovie ('drop', 'drop' + i, i);
		_root["drop" + i]._x = 100 + (i * 25);
		_root["drop" + i]._y = 300;
		_root["drop" + i].myLetter = strSplit*;
	}
}
for (var i = 0; i < strSplit.length; i++) {
	if (strSplit* != ' ') {
		this.createEmptyMovieClip ("text" + i, i + 100);
		//this.createEmptyMovieClip("textAlpha"+i, this.getNextHighestDepth());
    	_root["text" + i].createTextField ("txt", 100 + this.getNextHighestDepth (), 5, 5, 20, 20);
		_root["text" + i].txt.text = strSplit*;
		_root["text" + i]._x = _root["text" + i]._x + 15 * i;
		_root["text" + i].txt.type = "static";
		_root["text" + i].onPress = function () {
			this.startDrag ();
		};
		_root["text" + i].onRelease = function () {
			this.stopDrag ();
			theDrop = eval (this._droptarget);
			trace (theDrop.myLetter);
			if (theDrop.myLetter == this.txt.text) {
				trace ('match!');
			}
		};
	}
}

```

Pretty stuck on this one. Any ideas would be much appreciated!

Yossi
