8 Replies Latest reply on Feb 27, 2007 8:16 AM by Yiendos

    Drag and Drop Component

    i_am_captivate Level 1
      Hello,

      I am developing a quiz that involves the drag and drop component that comes with Flash.
      What I have is 4 Drag movieclip and 1 Target movieclip. 3 of the Drag movieclips are associated with the Target movieclip. The 4th movieclip is not assoicated to a Target movieclip, because it is incorrect.

      When I run this directly in Flash, it works great, I am using mcTween and the built in Tween class that Flash offers. The problem I am having is when I run the quiz in a stage environment. We have developed a stage component that encapsulates several SWF files and allows the viewer to navigate to any SWF file in the stage by simply clicking on the menu on the left.

      I know this is likely an issue with the usage, or lack thereof, _parent and _root. Problem is, I don't know what it is!

      Sorry if I have just confused you all, if you want me to clarify something, let me know.

      Thanks in advance for your help!

      Doug T
        • 1. Re: Drag and Drop Component
          kglad Adobe Community Professional & MVP
          if it's a _root issue, you may be able to remedy the issue by adding the following to your swf that's loaded into your _level0 swf:

          • 2. Re: Drag and Drop Component
            i_am_captivate Level 1
            Thanks for your reply, I do have this._lockroot = true on the first frame of the quiz. I am still having an issue with the drag and drop question in the quiz.

            Again, when I am in Flash, it works fine. But when I view it within our presenter window, the drag and drop does not work. I can drag the objects that I want, but the target does not get recognized.

            I've attached the code that is causing the problem.

            "this._parent.Target1" is recgonized in Flash, and it works fine, but if I put in our presentation window, it thinks that the actual question window is the target, not the actual target itself.

            Sorry if this is confusing, if you need clarification please let me know

            Thanks for your help!

            • 3. Re: Drag and Drop Component
              Ole Kristensen Level 1
              instead of :
              if ( target == router.target_objects ){

              try this:

              if (eval(target == router.target_objects
              ){
              • 4. Re: Drag and Drop Component
                kglad Adobe Community Professional & MVP
                use the trace() function to find the correct path. place

                trace(this);

                on the timeline who's path/instance name you want to reference.
                • 5. Re: Drag and Drop Component
                  i_am_captivate Level 1
                  Hello,

                  Thanks for your replies... I tried modifying the if clause, but it did not work. I can use a trace statement to find out what the target is and what level it is at, but I cannot do this when it is in our presenter window.

                  The code that is causing the problem can be accessed right in Flash. Just create a new quiz, then in the library, go to Quiz Files --> Learning Interactions --> Assets --> Controls --> Components, right click on drag and drop and select edit and then go to the actions frame. I am sure you already know this, but I just want to be clear I did not make this from scratch.

                  This code works great when the quiz is the root movie. But if the quiz is encapsulated within another movie, it does not work. I can drag the objects, but they just snap back to where their starting points are. In the code I attached earlier... "this._parent.Target1" used to be "target".

                  Just so you can see it all, I have attached the problematic function.

                  What happens is that if "this._parent.Target1" is set to "target", the movie will function fine in Flash, but will not work in our presentation window. I can drag the draggable objects, but they always snap back to the location of where they came from.
                  What this means is that the if clauses are not being run, and the function is always running the else clause, which puts all of the objects back at their starting point.

                  In the code attached, I am using "this._parent.Target1". Again, works fine in Flash, but when I put it in the presentation window, this time, I can drag the objects anywhere on the screen, but when I drop them, they think that the dropZone is the question itself, and not the Target (Target1). So I need to figure out how to make Target1 be the dropZone in our presentation window.

                  Any ideas?

                  Thanks again for all your help!
                  • 6. Re: Drag and Drop Component
                    i_am_captivate Level 1
                    Hello,

                    I have solved my issue. For anyone who is interested...

                    this._lockroot = true was causing the issue.

                    When you get to the drag and drop question, you must set this._lockroot = false. Once the question has completed, you need to set this._lockroot = true.

                    Just remember that this is only the case if you are loading the quiz into another SWF file. If the quiz is standalone, you don't need to do this.

                    Again, thanks to all who helped, much appreciated

                    Doug
                    • 7. Re: Drag and Drop Component
                      kglad Adobe Community Professional & MVP
                      you're welcome.
                      • 8. Drag and Drop Component
                        Yiendos
                        quote:

                        this._lockroot = true was causing the issue.
                        When you get to the drag and drop question, you must set this._lockroot = false. Once the question has completed, you need to set this._lockroot = true.



                        Hi Doug,

                        Not quite sure what you mean when you get to the question and when you have completed the question. What I've done so far is to paste the lockroot actionscript into frame 1 of the quiz template. I've tried adding the lockroot false and true to the start and end of the actionscript but that doesn't do much.

                        Paul

                        ***Edit***

                        Ok have got the drag and drop interaction to work via the addition of:
                        this._lockroot = true;
                        to the first frame of the Interactions layer. As the second interaction is a drag and drop for this frame I've then included:
                        this._lockroot = false;
                        and then in the third returned to:
                        this._lockroot = true;

                        Whilst the drag and drop routines work fine now, the next button continues to be disabled even after pressing check answer. Anybody got any ideas to get round this problem?

                        Cheers

                        Paul