3 Replies Latest reply on Jun 2, 2007 6:35 PM by ZypheR2007

    Drag & Drop Objects

    ZypheR2007
      Hi,
      I'm making a quiz with some drag and drop questions. User will drag object to certain point it becomes invisible. I now need to know how to change my action script to effect my score variable.

      Please tell me what to do to this code to effect 'score' variable...

      on (press){
      StartDrag("");
      }

      on (release){
      if (_droptarget =="/bag") {
      setProperty(root.NewShorts,_visible, 0);
      }
      else
      {
      StopDrag();
      }
      }
        • 1. Re: Drag & Drop Objects
          Thumbslinger Level 1
          Are you using an older version of Flash? "/bag" is a depriicated way to refer the root.

          Either way, just add something like this:

          on(release){
          if(_droptarget=="/bag") {
          setProperty(root.NewShorts,_visible,0);
          score = score + 1; //or whatever points or variable you're using
          }

          However, you probably need to check to see if the answer was correct? Are you putting this code on each object? You could use a loop or array to cycle through instead of having to have so much code but this should work.
          • 2. Re: Drag & Drop Objects
            ZypheR2007 Level 1
            lol no its a recent version the problem is University uses an older version so we get taught old methods.

            Well my quiz has 100 questions and a few of them will be this type. Dragging football kit to a kit bag but within the code I either simply set it to score+1 or score-1 depending on what object it is.

            Meaning this code is actioned in each of the 9 objects.

            I've tried what you have giving before and it refused to work so I'll give it ago and let you know if theres a problem.

            Thanks
            • 3. Re: Drag & Drop Objects
              ZypheR2007 Level 1
              That score = score+1 does not work :-(

              I have other projects I use that on for scoring its simple enough I just can't figure out how to change the score in reaction to the items being dropped in the correct place.

              My guess is its something to do with the fact the object is no longer visible once dropped and it doesnt add to the variable but then I'm no expect lol