7 Replies Latest reply on Mar 26, 2009 7:18 AM by insane_soni

    drag n drop

      Please check the below link:


      I am trying to do the same in Flash. But am stuck where am attaching the Movieclips from library. Am attaching

      code. Could you please have a look at it?
        • 1. drag n drop
          Ned Murphy Adobe Community Professional & MVP
          Can you explain the intention and pieces of this line:

          attach = this.attachMovie(this._name,this._name,this.getNextHighestDepth());

          If anything, it would appear to be trying to attach something to itself.

          I would expect it to be something that meets more of the following

          var attach ="activity"+i;
          this.attachMovie( linkkage_ID, attach, this.getNextHighestDepth());
          • 2. Re: drag n drop
            insane_soni Level 1
            thanks for the reply NedWebs.

            I have updated the code here.

            In this code the movieclips is being attached but I want apply the same actions to that attached movieclips which

            are applied to activityArr . If you've seen the above link, the transparent clip which is attaching to the original on

            onPress event, and onRelease event I am detectinh the hitTest with other movieclips from categoyArr.

            The problem here is when I press other movieclip, the attached movieclip of the previous MC gets removed I dont

            understand why. Please help me put in this.
            • 3. Re: drag n drop
              Ned Murphy Adobe Community Professional & MVP
              My original comments still stand. I don't see where you are adding any library objects, which is what attachMovie does.

              Each item you want to dynamically add from the library needs to have a linkage ID assigned to it. And when you use attachMovie, you utilize that ID to pull it from the library, give it a unique name, and set it in a depth of its own. The depth element would appear to be the only thing you are doing correctly.
              • 4. Re: drag n drop
                insane_soni Level 1
                Well even if I have attached the clips with another linkage id, the problem still persists.
                • 5. Re: drag n drop
                  insane_soni Level 1
                  updated line

                  attach = attachMovie("act"+linkage,"act"+noPos,this.getNextHighestDepth(),{_x:X[noPos], _y:Y[noPos]});
                  • 6. Re: drag n drop
                    Ned Murphy Adobe Community Professional & MVP
                    What are the linkage ID's you've assigned to the movieclips?

                    And I don't understand why you keep assigning the movieclip to the attach variable. You define the name of the attached movie in the function, as I showed in my example. You can then use that name to specify things for the attached movie.
                    • 7. Re: drag n drop
                      insane_soni Level 1
                      I am attaching the linkage identifiers of movieclips which are in activityArr array. the linkage ids are act1,..act21.

                      and m attaching the same here in attachmovie. and am assigning that movi to attach variable. So that i can access

                      it afterwords.

                      I just want to drag and drop objects from source movieclips(activityArr) to target movieclips. And I want to reuse

                      those source movieclips to drag and drop them on various targets(categoryArr).

                      To achieve this im attaching the source movieclips when I am using onPress event in it. Can you tell me any other

                      way to achieve this?