3 Replies Latest reply on Aug 23, 2006 6:05 AM by Lukewig

    Text styles?

    Level 7
      Hi,

      I have simple app that loads dta from a text file. The data is basically
      news in the form 'Headline' and 'content'

      What I want director to is loaqd this data and add it to a text member, but
      have the titles in bols and the content in plain.

      At the moment I have it loading the data/text in and inseting in text
      member, but don't know how to tell it to make the titles bold.

      The data comes in as 2 lists, (headline[] and content[])t: ie. headline[1],
      content[1] headline[2], content[2] ...etc
      The text member is named 'news'

      at the moment i am simply using:

      newText = ""
      repeat with n = 1 to 3 --only shows 1st 3 news items
      newText = newText & headline[n]&return&content[n]&return&return
      end repeat
      member("news").text = newText

      How do I set the headlines to be bold text???

      Any help appreciated.

      Tim.



        • 1. Re: Text styles?
          Level 7
          If your original text file is formatted then you can just import the
          whole file and keep the formatting.

          Create a new text member. Name it.

          member("new text member").fileName = "original file.rtf"

          If the original file was saved in rtf format, all of the original
          formatting will be imported along with the text itself.

          --
          Rob
          _______
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412-243-9119

          http://www.macromedia.com/software/trial/
          • 2. Re: Text styles?
            Level 7
            Unfortunately, its just a raw text file.

            infact saved text is in a list format. eg.

            "headline 1 here" , "content for 1st item here" , "headline 2 here",
            "content number 2 here", etc....

            I'm importing as a list, and then creating 2 other lists from this - ie.
            odd numbered items are headlines, even ones are content.


            I think i could probably write some code to change the 1st line of the text
            to be bold (member("news").line[1] = #bold), then check how many lines were
            added and do this again with member("news").line[totalLines+1] = #bold
            etc...
            Just wondering if there was a simple way; like there is in html/php..
            eg echo
            ("<strong>$headline[1]</strong><br>$content[1]<br><br><strong>$headline[2]</strong><br>$c ontent[2]")

            Thanks for the reply though!

            Tim



            "Rob Dillon - Adobe Community Expert" <rob@-remove-ddg-designs.com> wrote in
            message news:rob-4EED9B.07512723082006@forums.macromedia.com...
            > If your original text file is formatted then you can just import the
            > whole file and keep the formatting.
            >
            > Create a new text member. Name it.
            >
            > member("new text member").fileName = "original file.rtf"
            >
            > If the original file was saved in rtf format, all of the original
            > formatting will be imported along with the text itself.
            >
            > --
            > Rob
            > _______
            > Rob Dillon
            > Adobe Community Expert
            > http://www.ddg-designs.com
            > 412-243-9119
            >
            > http://www.macromedia.com/software/trial/


            • 3. Re: Text styles?
              Lukewig Level 1
              You can use (very basic) HTML to format the text. For example, you could do something like this

              str = "<b>This is a heading</b><p>This is some text</p>"
              ShowHTML(member("foo"), str)

              Otherise. just set the fontstyle of each line (like you were going to). Unfortunately, there is no "inside quotes $variables' like in PHP (which certainly makes formatting text much easier)

              -- Luke

              (ShowHTML function below - I hope - never quite worked out how this forum is meant to work...)