6 Replies Latest reply on Jul 1, 2015 8:50 AM by wfzen

    formatting when reading content from XML

    wfzen Level 1

      I have content read from XML. the problem is the space between lines are too big that it does not fit the text field. How can I control the space between bullet points? I can use either CS6 or CC.

       

      Thanks,

        • 1. Re: formatting when reading content from XML
          kglad Adobe Community Professional & MVP

          you should be parsing the xml to display to users, not displaying the raw xml in a textfield.

          • 2. Re: formatting when reading content from XML
            wfzen Level 1

            thank you, kglad. Can you show me an example of the right way? I don't quite understand what you mean by parsing the xml to display to users? Does it always need to go through a dynamic text field?

             

            Thanks.

            • 3. Re: formatting when reading content from XML
              kglad Adobe Community Professional & MVP

              no, there are a number of ways to present the loaded datat including in textfields, datagrids, comboboxes etc.  but i've never seen the raw xml displayed in a textfield. 

               

              i can feature that being helpful during development if you can't use a trace function, but otherwise can't envision any other time that would be beneficial.

               

              how you display the data and what you display is a design decision.

               

              paste a sample of the raw xml here and explain what you want to display to the user.

              1 person found this helpful
              • 4. Re: formatting when reading content from XML
                wfzen Level 1

                I'm using the XML games here: Search Results

                 

                I have question text similar to this inside question tag:

                <question1>

                You are quoting a homeowner”≥ policy in Texas. The Customer has disclosed the following information:

                - Built 1960

                - Heat- Electric- Installed in 1991

                - Roof- Asphalt shingles- Installed in 2005

                - Plumbing- Copper- Original- Good condition

                - Electrical- Circuit breakers- Copper wires- Partial replacement 1998

                Based on this, ...

                </question1>

                Each new line has a big space between lines that it spans too long vertically. I'd like to control it so bullet points has no space between them.

                • 5. Re: formatting when reading content from XML
                  kglad Adobe Community Professional & MVP

                  so you probably just need to strip blank lines:

                   

                  function stripF(s:String):String{

                  var sep:String = '*$%';

                  while(s.indexOf(sep)>-1){

                  sep += '%*&'

                  }

                  var a:Array=s.split('\n').join(sep).split('\r').join(sep).split(sep);

                  for(var i:int=a.length-1;i>=0;i--){

                  if(a[i]==''){

                  a.splice(i,1);

                  }

                  }

                  return a.join('\n');

                  }

                  • 6. Re: formatting when reading content from XML
                    wfzen Level 1

                    Thank you again for the script. I later found if the text is in TLF text, then there is no extra blank lines between text lines. For now, it solves my problem even though I have to stay with Flash CS6.