2 Replies Latest reply on Mar 7, 2008 6:09 AM by maith

    Align text in dynamic text box using HTML

    maith Level 1
      Hi,

      I am importing text from mysql, via php, to a dynamic text box in flash. I cannot get column 2 text to align left. It comes out like this:
      Column 1 Column 2
      James Kearns
      Mary Peterson
      Thomas Clark

      The php code I have is:
      print ("&dbpages=");
      while ($row =mysql_fetch_array($result,MYSQL_ASSOC)){
      print "<table>".$row['first_name']." "."<tr><td align=left>".$row['last_name']."</tr></td></table>"."\n";
      }

      The AS code is:

      Where database_txt is the dynamic text box.
      How can I align column 2 ?

      Thanks,
      Paul
        • 1. Re: Align text in dynamic text box using HTML
          ooba Level 1
          According to the HTML help section in Flash 8
          --------------------------------------------------------------
          About supported HTML tags
          This section lists the built-in HTML tags that Flash Player supports. You can also create new styles and tags by using CSS; see Formatting text with Cascading Style Sheet styles.

          For more information on supported HTML tags, see the following topics:

          Anchor tag
          Bold tag
          Break tag
          Font tag
          Image tag
          Italic tag
          List item tag
          Paragraph tag
          Span tag
          Text format tag
          Underline tag

          So, I do not think that tables are supported. But if I am wrong then someone will correct me :)
          • 2. Re: Align text in dynamic text box using HTML
            maith Level 1
            Thanks for your input.
            I have used the Text format tag and solved the problem. In the PHP code I used the tab stops \t. This aligns the data in Flash.
            The PHP code should now be:
            print ("&dbpages=");
            while ($row =mysql_fetch_array($result,MYSQL_ASSOC)){
            print "\t".$row['first_name']." \t ".$row['last_name']."\n";
            }


            The Flash code should now read:

            var resultPages_LV:LoadVars = new LoadVars();
            resultPages_LV.onLoad = function (success:Boolean){
            if (success){
            var myformat:TextFormat = new TextFormat();
            myformat.tabStops = [20,140];
            database_txt.htmlText = true;
            database_txt.htmlText = resultPages_LV.dbpages;
            database_txt.setTextFormat(myformat);
            }