4 Replies Latest reply on Aug 16, 2007 4:35 AM by Mauredo

    Problem with startDrag

    Mauredo
      Hello guys, im having some issues with a movieclip drag.

      many times, it just dont work how it was supposed to.

      i press and then it doesnt work, or sometimes i press and the movieclip goes away. weel many strange thing.

      this is by code:

      botaoProblemas.onPress = function() {
      this.startDrag();
      };

      botaoProblemas.onRelease = function() {
      botoes(this);
      };

      function botoes(mc:MovieClip) {
      mc.stopDrag();
      // and some random things
      }

      you can check what i am saying here: http://www.imauro.com/monografia/

      i thought it could be something with my movieclip but i copy/paste it from ilustrator and then just hit F8 and make a movieclip with Reg TL.

      any ideas how to make the bets out of drag? or something i need to take care of?

      thank you
        • 1. Re: Problem with startDrag
          Juankpro Level 2
          Seems like you are having som invisible objects over you buttons that might be blocking them from clicking. The problem is not your code, but maybe something else in the overall project structure
          • 2. Re: Problem with startDrag
            SymTsb Level 2
            Everything worked with the drag and drop as I would have expected. It wasn't until I dragged jogos (which loaded an external swf) that I started having problems. When I did that and then tried to drag and drop content again, jogos disappeared completely. Check the target of your loaded movie and make sure that it isn't being loaded into the same level as the buttons are being dragged into. Since the problem didn't occur until I went load a new section, I'd think that the unloaded movie (jogos) actually deleted the clip that the items are being dragged into. It's most likely an issue of scope so if you are doing this in AS2, you may just need to use the Delegate class to get the scope issue resolved.
            • 3. Re: Problem with startDrag
              Mauredo Level 1
              Im getting the problem now.

              The problem is, when i release the mouse with other MC in front of mine he doesnt drop it and the mc stay following my mouse.

              I thought that by using the getNextHighestDepth i would solve it, but guess not :(

              Any idea how to do this please?

              I am using object to make the mouse stuff like:

              var meuObject:Object = new Object();

              meuObject.onRollOut = function(){
              apagarTexto();
              }

              meuObject.onPress = function(){
              var novaDepth= this.getNextHighestDepth();
              this.swapDepths(novaDepth);
              this.startDrag();
              }

              meuObject.onRelease = function() {
              botoes(this);
              };


              for (i=0;i<6;i++){
              var newDepth = this.getNextHighestDepth();
              var newMC:String = "botaoMenu" + String(i);
              this.attachMovie(newMC,newMC,newDepth,meuObject);
              }
              • 4. Re: Problem with startDrag
                Mauredo Level 1
                allready done the debug, problem was i was refering to the object and not to the movieclip

                now i guess its a little better, but i still have a problem, when i pick it (and now it is with highestDepth everytime i press it) and clik very quick in everything i ended up with some problem with the movies going up or down but still moving.