5 Replies Latest reply on Feb 7, 2007 5:58 AM by Jan-Paul K.

    problem with tabs in xml text

    _mis_
      I have a problem with my XML setup here
      i use Tab key to aligh up info in the xml text for aligned display in the program
      hoever i tested on several computers and get different resolts.
      how can i fix this.

      Please view the linked Image
      http://img129.imageshack.us/img129/8394/flashtextproblemti4.jpg


      this is what happenes even thow all run xp and all run same latest flash version.
      Anyone got an ideer how i can solve this.

      BTW the font is verdana.

      ----------------------------
      This is my actionscript ....

      ------------------------------------------------------------------------------
      // Function to parse an address
      f_parseAddress = function () {

      // Set the text
      _root.stageholder.textfield.htmlText = this.firstChild.firstChild.firstChild.nodeValue;
      }

      // Create the XML object
      XML_address = new XML();

      // Set up the XML object
      XML_address.ignoreWhite = true;

      // Add the handlers
      XML_address.onLoad = f_parseAddress;

      // Load the XML file
      XML_address.load("./Data/xml/kontakt.xml");

      -------------------------------------------------------------------------------------
      This is my XML file
      ------------------------------------------------------------------------------------
      <?xml version="1.0" encoding="iso-8859-1"?>
      <text>
      <address>
      <![CDATA[
      <font size="20">Company name</font>

      Company name
      ..........................
      address
      address

      Dir. tlf. + xx xx xx xx xx
      + xx xx xx xx xx

      Mobil + xx xx xx xx xx
      + xx xx xx xx xx

      web: <a href=" http://www.xxxxxxxxxxxxx.xx"><b>www.xxxxxxxxxxxxx.xx</b></a>
      E-mail: <a href="mailto:xxxxxxx@xxxxxxxx.xx"><b>xxxxxxx@xxxxxxxx.xx</b></a>

      ]]>
      </address>
      </text>

      --------------------------------------------------------------------------------
      If anyone got a solution on how i can get my text to allign corect
      i would like to hear about it

      Best reguards

      Mis
        • 1. Re: problem with tabs in xml text
          Jan-Paul K. Level 1
          unfortunately I can't see andy tabs in the posted xml, you should use the attach code function to attach the xml with all tabs/whitespaces.

          I guess what you need to do is to set the tab stops in the textfield to your text aligned in a proper and consitent way..or you simple remove the tabs in the CDATA section of your xml.

          I am wondering anyway why you are using a structured format like XML to simply put in huge unstructured CDATA Sections. Wouldn't it be a much better style to create a clear xml structure with all the different meta informations for the address?
          • 2. Re: problem with tabs in xml text
            _mis_ Level 1
            Well i got some help on the actionscript irc to change my old xml setup into this one you see now
            as my old one didnt work with links

            but perhaps you have a better solution
            i do not know how to include the tabstops your talking about into my setup
            as ime no flash Expert :)

            so if you know that what i need is a setup where i acn make bold and normal and sized text and define
            some text to be links, as i can with my current setup you see.
            but still have it to aligh prober using tabs
            do you have any good setup that would make that possible ?

            best reguards

            Mis
            • 3. Re: problem with tabs in xml text
              kglad Adobe Community Professional & MVP
              don't format your data in your xml file. use flash to strip out all the whitespace from your xml data and format your data for display.
              • 4. Re: problem with tabs in xml text
                _mis_ Level 1
                hey Kglad

                sounds like the easyest thing in the world
                thing is i have no ideer how
                this is my xml setup nr 5 or so that i have worked up and down on and everytime someone new sees it
                its like ( why did you do it like that ) you should . . . . . .
                and then i get kinda like your explenation and i dont really get any wizer
                as i do not know how to

                thats why ime seeking help inhere.
                • 5. problem with tabs in xml text
                  Jan-Paul K. Level 1
                  alrighty then try this xml structure.
                  Note: formatting information like b, or linkage tags should not be part of the xml.
                  The XML format is a universal format for data, if you fill it with style information this is not good practive (in general, there are of course scenarios where it makes sense, also since (x)html IS also XML).
                  In your case you want to put the information about multiple companies in a xml file, but you let the flash decide how to display format this information.

                  so if you use the sugested XMl structure you will have full control of the layout within flash, because you can grab every piece of information from the xml and place it jsut where you want in flash and format it within flash.

                  Of course this process is more coding work than your previous attempt, but it pays of when you have a lot of data to process and when you want to have full control of the final layout.

                  But maybe its overkill for your application (I don't know how many companies will be stored in your xml and how complex the rest of the app is).