22 Replies Latest reply on Mar 22, 2011 7:08 AM by kglad-zqbLf4

    scrollpane problems

    melas076 Level 1

      dear all,

       

      i have a problem with this scrollpane, i try to a srcoll a movieclip which contains Text.htmlText from XML...

       

      This is a code:

       

      var mcMain:MovieClip;
      function init() {
          
           scrollPane.contentPath = "products";
           mcMain = scrollPane.content;
           mcMain.attachMovie(productmc, Product_MC, 1);
           trace(mcMain);
      }

       

      init();

       

       

      so productmc is the movieclip contains htmlText with pictures and repeated in 3 columns and several lines.

       

      i appreciate your help.

       

      regards,

      MELAS

        • 1. Re: scrollpane problems
          kglad-zqbLf4 Level 3

          attachMovie() accepts strings (or string variables) for the first two parameters.  so, you probably have that wrong.

           

          and the contentPath, "products", is a linkage id?

          • 2. Re: scrollpane problems
            melas076 Level 1

            how is linkage id?

            do you mean in the properties and actionscript to check ?

            • 3. Re: scrollpane problems
              melas076 Level 1

              there is another solutions to make it ?


              • 4. Re: scrollpane problems
                kglad-zqbLf4 Level 3

                where's the movieclip you're trying to add to your scrollpane?


                • 5. Re: scrollpane problems
                  melas076 Level 1

                  it is "productmc".

                  • 6. Re: scrollpane problems
                    kglad-zqbLf4 Level 3

                    WHERE is it?  is it in your library with a linkage id?  is it a swf or image the's external to your flash file?

                    • 7. Re: scrollpane problems
                      melas076 Level 1

                      yes it is in library with linkage id....

                      • 8. Re: scrollpane problems
                        kglad-zqbLf4 Level 3

                        if the linkage id of your library movieclip is productID, use;

                         

                         

                         

                            scrollPane.contentPath = "productID";

                        • 9. Re: scrollpane problems
                          melas076 Level 1

                          i don't understand plz explain me!!!!

                           

                          i have 3 things:

                           

                          1/ scrollpane

                          2/ MC called prodpic_MC with a linkage "productmc"

                          3/ MC called products with linkage "products"

                           

                          so the MC producmc is the MC contains the code htmlText with xml

                          and the MC products is an empty MC.

                           

                          So the code is the below:

                          function init() {
                             
                              scrollPane.contentPath = "products";
                              mcMain = scrollPane.content;
                              mcMain.attachMovie("productmc", "Product_MC", mcMain.getNextHighestDepth(), {_y:50*i+5, _x:5});
                              scrollPane.invalidate();
                              trace(mcMain);
                          }

                           

                          init();

                          • 10. Re: scrollpane problems
                            kglad-zqbLf4 Level 3

                            if the problem is sizing the scrollpane and the size depends on the the xml, you'll need to use some code to check when loading the xml completes and text is assigned.  when that occurs, invalidate() the scrollpane so it can redraw with the resized content.

                            • 11. Re: scrollpane problems
                              melas076 Level 1

                              i did it all things and xml loader works well.

                              and i am tryind and i didn't stop to solve it but i don't find

                               

                              kindly tell me if you it is posible to be do it or not....????

                               

                              regards,

                              MELAS

                              • 12. Re: scrollpane problems
                                melas076 Level 1

                                i am testing another scrollpanel and a movieClip it is working but not the old one :<

                                 

                                it is strange!!!!

                                 

                                in the productmc as instance Name and the linkage ID is the same name i have this code and it is working well when i put in the stage without the ScrollPane:

                                 

                                stop();

                                 


                                var Liste:XML = new XML();
                                Liste.ignoreWhite = true;
                                Liste.load("XML/products.xml");
                                Liste.onLoad =  function(success){

                                 

                                var galleriev = Liste.firstChild.childNodes;

                                var lon = galleriev.length;
                                var column = 0;
                                var line = 0;
                                for (var i = 0; i<lon; i++) {

                                var nom = galleriev[i].attributes.imgURL;
                                //trace(nom);
                                var ptitle = galleriev[i].attributes.titles;
                                //trace (ptitle);

                                 

                                 

                                _root.productmc.createTextField("prod_title"+i,i,0,0,200,300);

                                _root.productmc["prod_title"+i].multiline=true;

                                _root.productmc["prod_title"+i].html=true;

                                _root.productmc["prod_title"+i].wordWrap=true;

                                _root.productmc["prod_title"+i].htmlText ="<a href='"+ptitlelink+"'><img src='"+nom+"' /></a><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><p align='center'>"+ptitle+"</p>";

                                _root.productmc["prod_title"+i]._x = column*250;

                                _root.productmc["prod_title"+i]._y = line*300;

                                 

                                 

                                if (column == 2) {

                                 

                                column = 0;

                                 

                                line++;
                                }else{
                                column++;  
                                }
                                }
                                }

                                 

                                also i tried to replace "_root" by "Object(_root)" it isn't working at all

                                • 13. Re: scrollpane problems
                                  melas076 Level 1

                                  Is it possible to do this with ScrollPane?

                                  • 14. Re: scrollpane problems
                                    kglad-zqbLf4 Level 3

                                    is it possible to do what?

                                    • 15. Re: scrollpane problems
                                      melas076 Level 1

                                      is it possible to solve this?

                                      • 16. Re: scrollpane problems
                                        kglad-zqbLf4 Level 3

                                        is it possible to solve what?

                                        • 17. Re: scrollpane problems
                                          melas076 Level 1

                                          to solve what i am doing with scrollpane??

                                          i am still not find the solution for this!!!! ;(

                                           

                                          regards,

                                          MELAS

                                          • 18. Re: scrollpane problems
                                            kglad-zqbLf4 Level 3

                                            you've never explained what you're trying to do that's not working.  i've offered two solutions for two problems you might be having.

                                            • 19. Re: scrollpane problems
                                              melas076 Level 1

                                              I'm really sorry Mr. Kglad,

                                               

                                              I am explaining again what i want to do.

                                               

                                              I hope to do a scrolling for the MC called "productmc" i have 3 things in my flash files:

                                               

                                              1/ scrollpane
                                              2/ MC called prodpic_MC with a linkage "productmc"
                                              3/ MC called products with linkage "products" is an empty MC.

                                               


                                              So the code is the below is in the first frame of the scene:

                                               

                                              function init() {
                                                
                                                  scrollPane.contentPath = "products";
                                                  mcMain = scrollPane.content;
                                                  mcMain.attachMovie("productmc", "Product_MC", mcMain.getNextHighestDepth(), {_y:50*i+5, _x:5});
                                                  scrollPane.invalidate();
                                                  trace(mcMain);
                                              }

                                              init();

                                               

                                              and the MC producmc is the MC contains the code htmlText with xml which is inside of this MC like below:

                                               

                                              stop();

                                              var Liste:XML = new XML();

                                              Liste.ignoreWhite = true;
                                              Liste.load("XML/products.xml");
                                              Liste.onLoad =  function(success){

                                               

                                              var galleriev = Liste.firstChild.childNodes;

                                               

                                              var lon = galleriev.length;
                                              var column = 0;
                                              var line = 0;
                                              for (var i = 0; i<lon; i++) {

                                               

                                              var nom = galleriev[i].attributes.imgURL;
                                              //trace(nom);
                                              var ptitle = galleriev[i].attributes.titles;
                                              //trace (ptitle);

                                               


                                              _root.productmc.createTextField("prod_title"+i,i,0,0,200,300);

                                              _root.productmc["prod_title"+i].multiline=true;

                                              _root.productmc["prod_title"+i].html=true;

                                              _root.productmc["prod_title"+i].wordWrap=true;

                                              _root.productmc["prod_title"+i].htmlText ="<a href='"+ptitlelink+"'><img src='"+nom+"' /></a><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><p align='center'>"+ptitle+"</p>";

                                              _root.productmc["prod_title"+i]._x = column*250;

                                              _root.productmc["prod_title"+i]._y = line*300;

                                               

                                               

                                              if (column == 2) {

                                               

                                              column = 0;

                                              line++;

                                               

                                              }else{
                                              column++; 
                                              }
                                              }
                                              }

                                               

                                              and the scrollpane doesn't work....

                                               

                                              thanks for your cooperation.

                                               

                                              MELAS

                                              • 20. Re: scrollpane problems
                                                kglad-zqbLf4 Level 3

                                                the problem is the scrollpane doesn't resize to reflect the loaded text, correct?   if yes, i addressed that in message 10:

                                                 

                                                if the problem is sizing the scrollpane and the size depends on the the  xml, you'll need to use some code to check when loading the xml  completes and text is assigned.  when that occurs, invalidate() the  scrollpane so it can redraw with the resized content.

                                                • 21. Re: scrollpane problems
                                                  melas076 Level 1

                                                  so i will be like this right?

                                                  i put these on the first frame of the scene :

                                                   

                                                   

                                                  var prod:XML = new XML();

                                                   

                                                  prod.ignoreWhite = true;
                                                  prod.load("XML/products.xml");
                                                  prod.onLoad =  function(success){

                                                   

                                                  if (success) {
                                                  var galleriev = Liste.firstChild.childNodes;
                                                  var lon = galleriev.length;

                                                   

                                                  for (var i = 0; i<lon; i++) {
                                                  var nom = galleriev[i].attributes.imgURL;
                                                  //trace(nom);
                                                  var ptitle = galleriev[i].attributes.titles;
                                                  //trace (ptitle);

                                                   

                                                  }

                                                   

                                                  function init() {
                                                   
                                                      scrollPane.contentPath = "products";
                                                      mcMain = scrollPane.content;
                                                      mcMain.attachMovie("productmc", "Product_MC", mcMain.getNextHighestDepth(), {_y:50*i+5, _x:5});
                                                      scrollPane.invalidate();
                                                      trace(mcMain);
                                                  }

                                                   

                                                  init();

                                                   

                                                  }
                                                  }

                                                   

                                                  that right?

                                                  • 22. Re: scrollpane problems
                                                    kglad-zqbLf4 Level 3

                                                    no.  the xml has to loaded by that movieclip whose size is determined by the xml text.