16 Replies Latest reply on Sep 12, 2011 4:47 AM by Ned Murphy

    TITLE ADD

    melas076 Level 1

      dear all,

       

      Can you help me to add a title is "description[i]?

       

      this is the code....

       

      stop();
      function loadXML(loaded) {

       

      if (loaded) {

       

      xmlData = this.firstChild;
      links = [];
      description = [];
      thumbnails = [];
      a =[];
      total = xmlData.firstChild.childNodes.length;
      for (i=0; i<total; i++) {

       

      links[i] = xmlData.firstChild.childNodes[i].attributes.datas;
      description[i] = xmlData.firstChild.childNodes[i].attributes.label;
      thumbnails[i] = xmlData.firstChild.childNodes[i].attributes.thumbs;
      a[i] = xmlData.firstChild.childNodes[i].attributes.folder;
      thumbnails_fn(i);
      //trace(xmlNode.firstChild.childNodes[1].attributes.thumbs);

       

      initPreloading();
      }
      //firstImage();

       

      } else {

       

      content = "file not loaded!";

       

      }
      }

       

      xmlData = new XML();
      xmlData.ignoreWhite = true;
      xmlData.onLoad = loadXML;
      xmlData.load("data.xml");

       

      //p = 0;
       
      function thumbnails_fn(k) {

       

      this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());
      tlistener = new Object();
      tlistener.onLoadInit = function(target_mc) {

       

      target_mc._x = (eval("this.thumbnail_mc.t"+k)._width+40)*k;
      target_mc.pictureValue = k;

       

      //p = this.pictureValue;

       

      target_mc.onRelease = function() {
      aa = xmlData.firstChild.childNodes[k].attributes.datas;
      getURL("javascript:launch('"+aa+"')");

       

      };
      target_mc.onRollOver = function() {

       

      this._alpha = 100;

       

      };
      target_mc.onRollOut = function() {

       

      this._alpha = 80;

       

      };

       

      };
      image_mcl = new MovieClipLoader();
      image_mcl.addListener(tlistener);
      image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

       

      }
      LOADmc._x=(alignmc.width-LOADmc._width)/2;
      LOADmc._y=(alignmc.height-LOADmc._height)/2;

       

       

      i appreciate your help....

       

      MELAS

        • 1. Re: TITLE ADD
          Ned Murphy Adobe Community Professional & MVP

          Can you provide more specific information as to what you want and where you want it to occur?

          • 2. Re: TITLE ADD
            melas076 Level 1

            dear Ned,

             

            i want to put a title "description[i]" on the top of each thumbnails".

             

            regards,

            MELAS

            • 3. Re: TITLE ADD
              Ned Murphy Adobe Community Professional & MVP

              When you create each thumbnail movieclip, use the createTextField() method of the MovieClip class to add a textfield to the movieclip and assign the description[k] text to it.  If you are not familiar with the createTextField method, it is explained well in the Flash help documents with examples.

              1 person found this helpful
              • 4. Re: TITLE ADD
                melas076 Level 1

                kindly help me on this... i am very late and no time to try and test it....

                could you give me the code?

                 

                regards,

                MELAS

                • 5. Re: TITLE ADD
                  Ned Murphy Adobe Community Professional & MVP

                  You are very late for what?  Did you get all the code you show from somewhere and have no idea what it does?  You will have to spend a little time trying to get it working and show the attempt if it is not.

                  • 6. Re: TITLE ADD
                    melas076 Level 1

                    Dear Ned,

                     

                    i tried it several but i did find what i want.

                     

                    this is the code that i tried:

                     

                    function thumbnails_fn(k) {
                    bb = xmlData.firstChild.childNodes[k].attributes.label;
                    this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());
                    this.createTextField("title_txt"+k, this.thumbnail_mc.getNextHighestDepth());
                    this.title_txt.wordWrap=true;
                    this.title_txt.text = bb ;

                     

                    it appears 1 textfield not completly all the words and i have 2 product titles in xml....

                     

                    i appreciate your help...

                     

                    MELAS

                    • 7. Re: TITLE ADD
                      Ned Murphy Adobe Community Professional & MVP

                      There are probably a number of errors with what you are trying to do. 

                       

                      1) If bb is a variable, you should declare it as one (var bb = ...).

                      2) You should specify the location and dimension parameters of the textfield when you create it.

                      3) If you are using the thumbnail_mc as the depth basis, you should be adding the textfield to it instead of 'this'.

                      4) You are assigning the textfield an instance name that includes the 'k' value (title_txt"+k), but your last two lines are not using that name (this.title_txt.)

                      • 8. Re: TITLE ADD
                        melas076 Level 1

                        i tried that you said.... but :@:@

                         

                        function thumbnails_fn(k) {
                        var bb = xmlData.firstChild.childNodes[k].attributes.label;
                        this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());
                        this.thumbnail_mc.createTextField("title_txt"+k, this.thumbnail_mc.getNextHighestDepth());
                        thumbnail_mc.title_txt.wordWrap = true;
                        thumbnail_mc.title_txt.text = bb ;

                         

                        i appreciate your help....

                         

                        MELAS

                        • 9. Re: TITLE ADD
                          Ned Murphy Adobe Community Professional & MVP

                          You apparently didn't try all of what I said... you show nothing done with respect to items 2  and 4 that I listed.

                          • 10. Re: TITLE ADD
                            melas076 Level 1

                            see this code:

                             

                             

                            function thumbnails_fn(k) {
                            var bb = xmlData.firstChild.childNodes[k].attributes.label;
                            this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());
                            thumbnail_mc.createTextField("title_txt", this.thumbnail_mc.getNextHighestDepth(), 0, -50, 70, 20);
                            thumbnail_mc.title_txt.autoSize="center";
                            thumbnail_mc.title_txt.border = true;
                            thumbnail_mc.title_txt.text = bb ;
                            trace(bb);

                             

                            it works but just one title of 2 products. i want to appear 2 titles of 2 each products.

                            also if i do this:

                            function thumbnails_fn(k) {
                            var bb = xmlData.firstChild.childNodes[k].attributes.label;
                            this.thumbnail_mc.createEmptyMovieClip("t"+k, this.thumbnail_mc.getNextHighestDepth());
                            t.createTextField("title_txt", this.thumbnail_mc.getNextHighestDepth(), 0, -50, 70, 20);
                            t.title_txt.autoSize="center";
                            t.title_txt.border = true;
                            t.title_txt.text = bb ;
                            trace(bb);

                             

                            all things disappear.... why?

                             

                             

                             

                             

                            MELAS

                            • 11. Re: TITLE ADD
                              melas076 Level 1

                              Dear Ned,

                               

                               

                              Kindly help me.... about the previous post.

                               

                              regards,

                              MELAS

                              • 12. Re: TITLE ADD
                                Ned Murphy Adobe Community Professional & MVP

                                The way you wrote it, it is overwriting the first textfield.  In your first function code, try...

                                 

                                thumbnail_mc.createTextField("title_txt"+k, thumbnail_mc.getNextHighestDepth(), 0, -50, 70, 20);
                                thumbnail_mc["title_txt"+k].autoSize="center";
                                thumbnail_mc["title_txt"+k].border = true;
                                thumbnail_mc["title_txt"+k].text = bb ;

                                 

                                 

                                Your second attempt is targeting things that don't exist, again.

                                1 person found this helpful
                                • 13. Re: TITLE ADD
                                  melas076 Level 1

                                  Dear NEd,

                                   

                                  Thanks you very much for your help. i really appreciate what you did...

                                   

                                  but texts are below each others.... how to align them?

                                   

                                  regards,

                                  MELAS

                                  • 14. Re: TITLE ADD
                                    Ned Murphy Adobe Community Professional & MVP

                                    Look at the createTextField parameters.

                                    • 15. Re: TITLE ADD
                                      melas076 Level 1

                                      thanks you very much for your help!

                                       

                                      MELAS

                                      • 16. Re: TITLE ADD
                                        Ned Murphy Adobe Community Professional & MVP

                                        You're welcome