3 Replies Latest reply on Oct 6, 2010 10:11 AM by juliojacob

    UIScrollBar Help [URGENT]

    juliojacob

      The UIScrollBar in the code below doesn't appear and i don'tknow why... Some help, please?

       

      =======================================================================

       

      mc.createTextField("my_txt",mc.getNextHighestDepth(),10,10,260,280);

      mc.my_txt.html = true;

      mc.my_txt.wordWrap = true;

      mc.my_txt.multiline = true;

       

      var loadTxt:XML = new XML();

      loadTxt.load("homeText.xml");

      loadTxt.ignoreWhite = true;

      System.useCodepage = true;

      var i=0;

      loadTxt.onLoad = function(){

           mc.my_txt.text = loadTxt.firstChild.firstChild.childNodes;

           mc.my_txt.createClassObject(mx.controls.UIScrollBar,"vScroll",mc.my_txt.getNextHighestDep th());

           mc.my_txt.vScroll.setScrollTarget(mc.my_txt);
           mc.my_txt.vScroll.setSize(10, mc.my_txt._height);
           mc.my_txt.vScroll.move(mc.my_txt._x + mc.my_txt._width, mc.my_txt._y);
           mc.my_txt.vScroll.lineScrollSize = 2;
           mc.my_txt.vScroll.pageScrollSize = 5;

       

           my_txtFormat = new TextFormat();

           my_txtFormat.size = 11;
           my_txtFormat.font = "Verdana";
           my_txtFormat.color= 0x000000;
           mc.my_txt.setTextFormat(my_txtFormat);

      };

       

      =======================================================================

        • 1. Re: UIScrollBar Help [URGENT]
          Ned Murphy Adobe Community Professional & MVP

          I don't think you can assign a scrollbar as a property of a textfield, though I may be wrong, but try...

           

          this.createClassObject(mx.controls.UIScrollBar,"vScroll",mc.my_txt.getNextHighestDepth());

               vScroll.setScrollTarget(mc.my_txt);
               vScroll.setSize(10, mc.my_txt._height);
               vScroll.move(mc.my_txt._x + mc.my_txt._width, mc.my_txt._y);
               vScroll.lineScrollSize = 2;
               vScroll.pageScrollSize = 5;

           

          And be sure that you have a copy of the UIScrollbar component in your library.

          1 person found this helpful
          • 2. Re: UIScrollBar Help [URGENT]
            juliojacob Level 1

            Hi, Ned!

            I tried to not assign a scrollbar as a property of a textfield, but it didn't work...

            And yes, i have a copy of the UIScrollbar component in my library... I really don't know why it don't working...

            Thanks for help anyway!

            • 3. Re: UIScrollBar Help [URGENT]
              juliojacob Level 1

              Hi, everybody! Finally, the question is answered!

               

              My mistake was create an object INSIDE the TextField. I created the UIScrollBar in _root and it work's fine! I'll post the entire code above to help others. Thanks Ned and everybody anyway!

               

              buttom_btn.onRelease=function(){
                      _root.createEmptyMovieClip("box01",_root.getNextHighestDepth());
                      box01
              .lineStyle(1, 0xCCCCCC);
                      box01
              .beginFill(0xFFFFFF,70);
                      box01
              .moveTo(0, 0);
                      box01
              .lineTo(280,0);
                      box01
              .lineTo(280,300);
                      box01
              .lineTo(0,300);
                      box01
              .endFill();
                      box01
              ._x =120;
                      box01
              ._y = 190;
                      box01
              ._alpha=0;
                     
              var box01Alfa:Tween = new Tween(box01,"_alpha",Regular.easeOut,0,100,1,true);
                      box01.createTextField("tf",box01.getNextHighestDepth(),10,10,260,280);
                      box01
              .tf.html = true;
                      box01
              .tf.wordWrap = true;
                      box01
              .tf.multiline = true;
                     
              var loadTexto:XML = new XML();
                      loadTexto
              .load("texto.xml");
                      loadTexto
              .ignoreWhite = true;
                     
              System.useCodepage = true;
                     
              var i=0;
                     
              loadTexto.onload = function(){
                              box01
              .titEmpresa.text = loadTexto.firstChild.firstChild.childNodes;
                             
              _root.createClassObject(mx.controls.UIScrollBar,"vScroll",2);
                              vScroll
              .setScrollTarget(box01.tf);
                              vScroll
              .setSize(10, box01._height);
                              vScroll
              .move(box01._x + box01._width, box01._y);
                              vScroll
              .lineScrollSize = 2;
                              vScroll
              .pageScrollSize = 5;
                              tfFormat = new TextFormat();
                              tfFormat
              .size = 11;
                              tf
              .font = "Verdana";
                              tf
              .color= 0x000000;
                              box01
              .tf.setTextFormat(tfFormat);
                     
              };