Link to home
Start Free TrialLog in
Avatar of crazycharlie
crazycharlie

asked on

draggable movie verifications and features

I have a Flash 5 project that has x number of draggable movies and the same number of targets.  Only one target per movie is correct.  When the user drags all the movies onto the correct targets, they get a movie that congratulates them.  If the user drags all items incorrectly, there's a movie that tells them the order is incorrect and asks them to try again.

The problems I'm encountering:

1) If the user drags gets at least one item correct, but doesn't drag all items to their correct box, I need a way to send them to the movie telling them to try again.
2) The try again movie needs to have a button that will reset the test but give them only two more chances to get it right. (So, a global counter incrementing per incorrect series.)
3) Once they've incorrectly placed the items 3 times, they need to be sent to a third movie telling them they need to start the lesson over from the beginning.
4) I need a way to create a button to globally restart the flash program without actually reloading the html page.

Thanks for all the help.

Ch@rlie
Avatar of sexyrexy
sexyrexy

How do you determine when to check whether the items have been properly dragged? Does the user click an "I'm finished" button to check and see? Or are they only supposed to get one "drag" per item (i.e. after they've moved it and released it once, if it is not correct then they lose their chance to move that item correctly)?
Avatar of crazycharlie

ASKER

Correct.  If they drag an item, no matter if it's correct or incorrect, the draggable movie is set to visible=0 and the target is set to a frame which displays a static shot of the target and dragged item combined.  So, nothing is draggable after dropping onto a target.  I need a way to count all drags and also verify whether a drop was correct or incorrect.

I hope this is clearer.

Ch@rlie
ASKER CERTIFIED SOLUTION
Avatar of sexyrexy
sexyrexy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm still having some problems with this.  The information looks very thorough, but I'm not clear on where the instance names are set within the functions.
Instance names are set on the movie clip properties... "this.name" is a string that is equal to the instance name. So for example, on a movie clip named "dragMC", "_parent[this.name]" equals "_parent.dragMC"

The instance names are added to the array within setFailure() and setSuccess()

corrections:

function showResults() {
  if(tryCount<3) {
    tryCount++;
    clipDragged=0;
    strReturn="You dragged " add arrSuccess[0].length add " clips correctly: ";
    for(i=0;i<arrSuccess.length;i++) {
      strReturn=strReturn add arrSuccess[0][i] add "; ";
    }
    strReturn=strReturn add " and " add arrFailure[0].length add " clips incorrectly: ";
    for(i=0;i<arrFailure.length;i++) {
      strReturn=strReturn add arrFailure[0][i] add "; ";
    }
    setProperty("resultClip.restartTestBtn",_visible,1);
  } else {
    strReturn="You failed to correctly place all items after three tries. Please start over.";
    setProperty("resultClip.restartMovieBtn",_visible,1);
  }
  resultClip.textfield.text=strReturn;
}


function ResetDraggableClips() {
  for(i=0;i<arrFailure[0].length;i++) {
    setProperty(eval(arrFailure[0][i]),_x,arrFailure[1][i]);
    setProperty(eval(arrFailure[0][i]),_y,arrFailure[2][i]);
  }
  for(i=0;i<arrSuccess[0].length;i++) {
    setProperty(eval(arrSuccess[0][i]),_x,arrSuccess[1][i]);
    setProperty(eval([arrSuccess[0][i]),_y,arrSuccess[2][i]);
  }
}
I understand that this.name is equal to the specific instance name, but for whatever reason, what I have isn't working correctly.  Here's what I have currently.  http://www.creativeflavor.com/DragableChoices_updated.fla

Sorry if this is too obvious and I'm just not getting it... :D
Here's what I had before so you can see the functionality that was working.

http://www.creativeflavor.com/DragableChoices.fla
Can anyone else help me with this?

Thank you.
I've looked at this further and My program is now completing all functions except for resetting the original location of the draggable mc's.  I'm not sure how to set the initial location.  I've tried setting something similar to this on each button:

    _root.xpos1 = _target._x;
    _root.ypos1 = _target._y;

and then trying to grab that value from the button for restarting the program like this:

    setProperty ("Button1", _x, _root.xpos1);
    setProperty ("Button1", _y, _root.ypos1);

But that doesn't work.