10 Replies Latest reply on Feb 2, 2008 9:42 AM by robdillon

    Parsing a text

    GerryIsHere Level 1
      Hi there!

      Does somebody can tell me how can I “parse” the content of a variable (html text) to multiple movieclip/textfields.
      I unsuccessfully tried to with bottomScroll and maxScroll...

      Many thanks in advance for any help!

        • 1. Re: Parsing a text
          ewon15 Level 1
          Hi GerryIsHere,

          If you post more information I might be able to help you. I would need example code of both the actionscript you are using and your text file (or what it is you want to parse).

          ewon15
          • 2. Re: Parsing a text
            GerryIsHere Level 1
            Hello ewon15!

            Thanks for responding.

            A brief survey of the operations:
            On my site users perform searches (Flash-->PHP-->MySQL).
            Results are most often html lists or texts.
            They are displayed in scrollable dynamic text fields.
            And, most often, result displayed is only a part of the total result.

            The total result often exceeds the dimensions of a printed page.

            At the moment, I send the variable value (the "total result") to a built-in movie clip named PRINTMC which contains a dynamic text field named printFld.
            PRINTMC contains:
            first frame label "#p" and printFld, stop();
            second frame "#b" and a 600x800 bounding box

            I have also built two other movie clips named PRINTMCTWO and PRINTMCTHREE identicals to PRINTMC and ready to receive, if necessary, the continuation of what will be printed on the first page.

            Of course I only get printed, at the moment, the first part of the total result.
            The part which fits the page.

            The problem is:
            How to parse myPrintStr (see attached code) to have it printed in full ?





            • 3. Re: Parsing a text
              ewon15 Level 1
              hmmm this is a bit more complex than i thought. i'm not sure i can help!

              sorry :0(
              • 4. Re: Parsing a text
                GerryIsHere Level 1
                Don't be sorry...
                Hope one of the gurus around will help me to solve this problem which sounds as elementary for an expert !

                Best,

                Gerry
                • 5. Re: Parsing a text
                  robdillon Most Valuable Participant
                  Take a look at this article, it seems to cover what you need: http://www.peachpit.com/articles/article.aspx?p=1019624&seqNum=8
                  • 6. Re: Parsing a text
                    GerryIsHere Level 1
                    Hi Rob!

                    Thank you! Thank you!
                    I got two tutorials from peachpit but I never saw this one...

                    I give it a try and give you some feeback about the results!

                    Best,

                    Gerry
                    • 7. Re: Parsing a text
                      GerryIsHere Level 1
                      quote:

                      Originally posted by: Rob Dillon http://www.peachpit.com/articles/article.aspx?p=1019624&seqNum=8


                      I tried it.
                      But it still prints the first part of the text on one page.
                      I give you below the code in my print button.
                      I didn't understood very well the "keep adding pages to the print job"
                      May be my writing is wrong as I misplaced my if/else statement...

                      If you can find my error...



                      • 8. Re: Parsing a text
                        robdillon Most Valuable Participant
                        You need to use the code from the bottom of that 8th page. That's where all of the code is listed.
                        • 9. Re: Parsing a text
                          GerryIsHere Level 1
                          Yes, of course.
                          I noticed.

                          Did you try the code in a new file?
                          I doesn't work.
                          trace(maxScroll); is undefined which result in only one page printed.

                          The problem with the code is located in
                          var visibleRows:Number = textArea.viewableRows;
                          which should have been
                          var visibleRows:Number = (textArea.bottomScroll) - (textArea.scroll);
                          (my targets have different names but it doesn't change anything to the problem)

                          • 10. Re: Parsing a text
                            robdillon Most Valuable Participant
                            Yes, I did try the code in a new file and it worked fine. If you take your text and place it in a new movie using the code from the article, test the movie and then enlarge the window to see the whole text object that holds the copy to be printed. You will see that textfield is set to be a full page. If your text does not fill that space then you may have a problem with the way that Flash is reading your text, or you may not have enough text to fill that space. You can change the size of the textfield to force more pages.