3 Replies Latest reply on Jan 24, 2011 10:17 AM by kglad

    Get rid of createClassObject

    Ron Colmen Level 2

      When I click a button how can I delete this scrollbar?

       

       

      this.createClassObject(mx.controls.UIScrollBar, "my_sldr2", this.getNextHighestDepth());

      this.my_sldr2.setScrollTarget(this.text);this.my_sldr2.setSize(26, 280);

      this.my_sldr2._x += 500;

      this.my_sldr2._y += 200;

       

      I used this in a button and neither of them worked.

       

      on(release){

      this.my_sldr1.removeMovieClip()

      }

       

      on(release){

      destroyObject("my_sldr1");

      }

        • 1. Re: Get rid of createClassObject
          kglad Adobe Community Professional & MVP

          removeMovieClip() will work if applied to your instance.  so, if you applied that to this.my_sldr2 WHILE in the scope of the same "this" where my_sldr2 was created, you wouldn't have a problem.

           

          because you have a problem, you can infer that your scope is incorrect when used within that on(release) or you have a typo. in the case of a typo (eg, you used my_sldr1 instead of my_sldr2), just fix that typo.

           

           

          if you're out of scope, it's not possible to determine the path you should use (from the info supplied) to get you within the correct scope.  but, if that's a movieclip button and it's on the same timeline as your createClassObject() code, you would use:

           

          on(release){

          this._parent.my_sldr2.removeMovieClip();

          }

           

          if both those fail, use:

           

          trace(this);  // below your createClassObject()

           

          and trace(this) within your on(release).

          • 2. Re: Get rid of createClassObject
            Ron Colmen Level 2

            Thanks Kglad!!!

            • 3. Re: Get rid of createClassObject
              kglad Adobe Community Professional & MVP

              you're welcome.