7 Replies Latest reply on Aug 19, 2011 12:54 PM by kglad

    SwapDepth Problem

    juresti Level 1

      I have an interavtive module where user drags objects using droptarget. Once items are filled in the timeline moves to a frame where there is only one object. What I dont understand is that random objects continue to show up at the end frame where there is only one object! How do these objects show up?

        • 1. Re: SwapDepth Problem
          kglad Adobe Community Professional & MVP

          if you add an object to your timeline using actionscript it will remain unless its parent is removed in the timeline or it's removed using actionscript.

          1 person found this helpful
          • 2. Re: SwapDepth Problem
            juresti Level 1

            Drag Code. It is a mess. The dragged images are "holder_mc(n)" I'm having major issues. I want the object on top once it is dragged. It works sort of but when the second object is selected an object (zoom(n)) above the first object disappears. Any help is appreciated.

             

             

            with(this){
                startDrag(false);
                this.swapDepths(getNextHighestDepth( ));

             

            }}

             

                holder_mc0.onRelease = function(){
                   
                   
                holder_mc0.stopDrag();
                    if ((eval(this._droptarget) == string02) ||(eval(this._droptarget) == main_txt2)){
                    this.onTarget=true;
                    string02.gotoAndStop(2);
                    boxes.box02._visible = false;
                    this._visible = false;
                    number04._visible = false;
                    menu_txt0._visible = false;
                    zoom0._visible = false;
                    main_txt2.setNewTextFormat(mainText);
                    main_txt2.text = $parsedObject.tool[0].name
                    this.swapDepths(zoom0);
                    test == (test++)
                    //trace(test);
                    if (test == 5) {
                    gotoAndPlay(4);
                    }else
                    {
                        }
            }else
            {
                    this.onTarget=false;
                     this.swapDepths(zoom0);
                   
                }}
               
            holder_mc1.onRelease = function(){
                holder_mc1.stopDrag();
               
                    if ((eval(this._droptarget) == string05) ||(eval(this._droptarget) == main_txt1)) {
                    this.onTarget=true;
                    string05.gotoAndStop(2);
                    boxes.box01._visible = false;
                    this._visible = false;
                    number05._visible = false;
                    menu_txt1._visible = false;
                    zoom1._visible = false;
                    main_txt1.setNewTextFormat(mainText);
                    main_txt1.text = $parsedObject.tool[1].name
                    test == (test++)
                    if (test == 5) {
                    gotoAndPlay(4);
                    }else
                    {
                        }
            }else
            {
                    this.onTarget=false;
                    this.swapDepths(zoom1);
                }}

            • 3. Re: SwapDepth Problem
              kglad Adobe Community Professional & MVP

              with(this){
                  startDrag(false);
                  this.swapDepths(getNextHighestDepth( ));

               

              }}

               

              i assume is in an onPress and should be:

               

              holder_mc0.onPress=function(){

              this.startDrag();

              this.swapDepths(this._parent.getNextHighestDepth());  // assuming you have no components in your app

              }

              • 4. Re: SwapDepth Problem
                juresti Level 1

                Ugh I forgot I had this code in red:

                 

                var j:Number;

                 

                for (j = 0; j < 14; j++) {
                       
                eval("holder_mc"+j).onPress = function() {

                 

                with(this){
                    startDrag(false);
                    this.swapDepths(getNextHighestDepth( ));

                 

                }}

                 

                    holder_mc0.onRelease = function(){
                       
                       
                    holder_mc0.stopDrag();
                        if ((eval(this._droptarget) == string02) ||(eval(this._droptarget) == main_txt2)){
                        this.onTarget=true;
                        string02.gotoAndStop(2);
                        boxes.box02._visible = false;
                        this._visible = false;
                        number04._visible = false;
                        menu_txt0._visible = false;
                        zoom0._visible = false;
                        main_txt2.setNewTextFormat(mainText);
                        main_txt2.text = $parsedObject.tool[0].name
                        this.swapDepths(zoom0);
                        test == (test++)
                        //trace(test);
                        if (test == 5) {
                        gotoAndPlay(4);
                        }else
                        {
                            }
                }else
                {
                        this.onTarget=false;
                         this.swapDepths(zoom0);
                       
                    }}
                   
                holder_mc1.onRelease = function(){
                    holder_mc1.stopDrag();
                   
                        if ((eval(this._droptarget) == string05) ||(eval(this._droptarget) == main_txt1)) {
                        this.onTarget=true;
                        string05.gotoAndStop(2);
                        boxes.box01._visible = false;
                        this._visible = false;
                        number05._visible = false;
                        menu_txt1._visible = false;
                        zoom1._visible = false;
                        main_txt1.setNewTextFormat(mainText);
                        main_txt1.text = $parsedObject.tool[1].name
                        test == (test++)
                        if (test == 5) {
                        gotoAndPlay(4);
                        }else
                        {
                            }
                }else
                {
                        this.onTarget=false;
                        this.swapDepths(zoom1);
                    }}

                • 5. Re: SwapDepth Problem
                  kglad Adobe Community Professional & MVP

                  start by fixing this:

                   


                   

                  var j:Number;

                   

                  for (j = 0; j < 14; j++) {
                  this["holder_mc"+j].onPress = function() {

                  this.startDrag(false);

                  this.swapDepths(this._parent.getNextHighestDepth( ));

                  }

                  }

                   


                  1 person found this helpful
                  • 6. Re: SwapDepth Problem
                    juresti Level 1

                    It looks like the path below fixed all the problems.

                     

                    this._parent.getNextHighestDepth( )

                    • 7. Re: SwapDepth Problem
                      kglad Adobe Community Professional & MVP

                      great.