4 Replies Latest reply on Aug 27, 2007 2:29 PM by sbryner

    Get _txt name

    sbryner Level 1
      Hey all,

      How do I get the name of a _txt or _mc that I drag an MC over?

      I can drag a_mc to b_txt and when it does I want to store b_txt's name into a variable getMcName()
      That way if i drag a_mc over c_txt it would store that name instead.

      I think I have to use .hitTest but not sure how it actually can get the name?
      any ideas?

      Seems so simple.

        • 1. Re: Get _txt name
          SymTsb Level 2
          each object on the stage is given a name property especially when it is named in the property inspector or dynamically using actionscript.
          • 2. Re: Get _txt name
            sbryner Level 1
            I'm trying to store the name I drag my movieClip over into a variable.

            Say I'm dragging around the screen "A_mc" and I drag it over "B_txt"
            I want the variable "getMcName" to store "B_txt.name"

            I just don't know how to collect the name when "A_mc" intersects or collides with
            "B_txt" Do you know how to do that?


            • 3. Re: Get _txt name
              NSurveyor Level 2
              When a MovieClip is dragged using startDrag, the Object you drag the MovieClip over is stored in MovieClip._droptarget, but in Slash notation for some reason.
              Example code for A_mc:

              A_mc.onPress = function(){
              this.onMouseMove = function(){
              getMcName = eval(this._droptarget)._name;
              mc.onMouseUp = function(){
              delete this.onMouseMove;
              • 4. Re: Get _txt name
                sbryner Level 1
                exactly what I was hoping for.
                Thank you it works great.
                I was stuck on

                this.onMouseMove = function(){
                getMcName = eval(this._droptarget)._name;

                thanks for the help