What type of test are you trying to make? from just messing with that tutorial it doesn't check to see if the answer is right unless I'm missing something.
Most test like this use hit test in areas and you use some code to determine the correct answer.
Sorry for the crudeness but this is a simple test I made in in about 5 minutes
The movie is simple a text box with to tell you if you are right or wrong a button that is use to check the answers three draggable movie clips and three drop zone movie clips
The code
// Set the on press functions for the blocks
red_block.onPress = function () {
// Start Drag
startDrag(this, false);
}
green_block.onPress = function () {
// Start Drag
startDrag(this, false);
}
blue_block.onPress = function () {
// Start Drag
startDrag(this, false);
}
// Set the on release funtions for the blocks
red_block.onRelease = red_block.onReleaseOutside = function() {
// Stop the drag
this.stopDrag();
}
green_block.onRelease = green_block.onReleaseOutside = function() {
// Stop the drag
this.stopDrag();
}
blue_block.onRelease = blue_block.onReleaseOutside = function() {
// Stop the drag
this.stopDrag();
}
// Set up the check button
check_button.onRelease = function() {
// Set a flag to true
var all_right:Boolean = true;
// Check for the correct answer
if(!zone_1.hitTest(blue_block._x,blue_block._y)) {
// Set the flag to false
all_right = false;
}
// Check for the correct answer
if(!zone_2.hitTest(red_block._x,red_block._y)) {
// Set the flag to false
all_right = false;
}
// Check for the correct answer
if(!zone_3.hitTest(green_block._x,green_block._y)) {
// Set the flag to false
all_right = false;
}
// Check to see if all_right is still true
if(all_right) {
results.text = 'Correct';
} else {
results.text = 'Try Again';
}
}
- // Set the on press functions for the blocks
- red_block.onPress = function () {
-
- // Start Drag
- startDrag(this, false);
-
- }
-
- green_block.onPress = function () {
-
- // Start Drag
- startDrag(this, false);
-
- }
-
- blue_block.onPress = function () {
-
- // Start Drag
- startDrag(this, false);
-
- }
-
- // Set the on release funtions for the blocks
- red_block.onRelease = red_block.onReleaseOutside = function() {
-
- // Stop the drag
- this.stopDrag();
-
- }
-
- green_block.onRelease = green_block.onReleaseOutside = function() {
-
- // Stop the drag
- this.stopDrag();
-
- }
-
- blue_block.onRelease = blue_block.onReleaseOutside = function() {
-
- // Stop the drag
- this.stopDrag();
-
- }
-
- // Set up the check button
- check_button.onRelease = function() {
-
- // Set a flag to true
- var all_right:Boolean = true;
-
- // Check for the correct answer
- if(!zone_1.hitTest(blue_block._x,blue_block._y)) {
-
- // Set the flag to false
- all_right = false;
-
- }
-
- // Check for the correct answer
- if(!zone_2.hitTest(red_block._x,red_block._y)) {
-
- // Set the flag to false
- all_right = false;
-
- }
-
- // Check for the correct answer
- if(!zone_3.hitTest(green_block._x,green_block._y)) {
-
- // Set the flag to false
- all_right = false;
-
- }
-
- // Check to see if all_right is still true
- if(all_right) {
- results.text = 'Correct';
- } else {
- results.text = 'Try Again';
- }
-
-
- }
simple_test.zip
(7.24 KiB) Downloaded 406 times