12 Replies Latest reply on Sep 14, 2010 10:05 AM by DevantEh

    RTF not formating correctly

    rafa@mediatech Level 1

      Hi everyone

      I imported an RTF document and inlcuded it in my splash screen. I have some lingo that updated the ducumented when the EXE is ran:

      on beginsprite me
           member("Lawyer_bio").fileName = the moviePath & "Lawyer_bio.rtf"
           member("Lawyer_bio").rtf = member("Lawyer_bio").rtf
      end
      

       

      For some reason, the bullet points on my document are not formating correctly. It works fine with some RTF documents, but with other it does the following:

      rtf.jpg

      See how only the first bullet if formating correctly, why are the other ones not? Like I said, it doesn't happen with all the RTF documents.

       

      thank you for your time,

      Rafa.

        • 1. Re: RTF not formating correctly
          DevantEh Level 1

          You're doing cool stuff Rafa.


          I suspect there's something with a CR or LF that needs to be stripped or added.

          • 2. Re: RTF not formating correctly
            rafa@mediatech Level 1

            Hi DevantEh,

            What do you mean by CR or LF?

             

            Rafa.

            • 3. Re: RTF not formating correctly
              Sean_Wilson Adobe Community Professional

              Carriage Return or Line Feed - numToChar(13) or numToChar(10)

               

              Windows uses CRLF to delimit lines of text, Macintosh uses CR (Director's RETURN constant) and Unix uses LF.

              • 4. Re: RTF not formating correctly
                DevantEh Level 1

                Rafa,

                If I have this right:
                A Carriage Return (CR)  is  numtochar(0)
                A Line Feed (LF) put LFis numtochar(32)

                There's an LF or CR out of place causing your bullet format error.  I'm sure of it.  You could remove it with Lingo.

                You could write a handler to fix the formatting.   A sort of "parser" to look for the character just before the bullet character, and and remove the CR - I think that would do it easily.  Let me know if you get stuck.  Good luck.

                • 5. Re: RTF not formating correctly
                  DevantEh Level 1

                  Rafa,

                   

                  If I have this right:

                  A Carriage Return (CR)  is  numtochar(0)

                  A Line Feed (LF) is numtochar(32)

                   

                  There's an LF or CR out of place causing your bullet format error.  I'm sure of it.  You could remove it with Lingo.

                   

                  You could write a handler to fix the formatting.   A sort of "parser" to look for the character just before the bullet character, and remove the CR - I think that would do it easily.   Good luck.

                  • 6. Re: RTF not formating correctly
                    rafa@mediatech Level 1

                    Sean and DevantEh:

                    Thank you for replying. DevantEh, can you give me an example on how to address these items of my RTF via lingo?

                     

                    Thank you for your time,

                    Rafa.

                    • 7. Re: RTF not formating correctly
                      DevantEh Level 1

                      This will fix the formatting:
                      put the Text cast member on the stage
                      put an empty Text cast member on the stage.
                      use Lingo to put the text from the wonky formatted text into the

                      empty text cast member.

                      I imported an RTF file with the deliberate messed up bullet

                      appearance.  I put the cast on the stage, I assigned a variable to

                      the member of the sprite.  Assigned a variable to the member of

                      the sprite for the empty text cast member.
                      I set the text of the empty cast to the text of the wonky cast.
                      i beheld that the new cast contained the text with the formatting

                      all looking proper.  This was unexpected.  I was then going to

                      examine the char just before the bullet using Lingo, and add or

                      remove whatever was necessary to match the chars that were just

                      before the properly formatted bullet.  I didn't need to get that far.
                      putting  the wonky RTF bullet text into a new text cast with

                      Lingo resolved the formatting issue.  Try it and see.
                      set WONKY = the member of sprite 3
                      set SURPRISE = the member of sprite 4
                      set the text of SURPRISE = the text of WONKY
                      and behold!  The formatting is now correct.

                      • 8. Re: RTF not formating correctly
                        rafa@mediatech Level 1

                        Hi DevantEh,

                        Thank you for your help. I tried what you suggested. The text from the RTF is transfered to the text member on stage, but the formating is not kept. It looks like standard text (no bolds, funky looking bullets like these, §). How can I make the standard text box use the same format as the RTF?

                         

                        thanks!

                        Rafa.

                        • 9. Re: RTF not formating correctly
                          DevantEh Level 1

                          Dear Rafa,

                           

                          Please check to see that the sprite cast you were transferring into was not a accidentally a “field” cast member.  Text and field objects have different properties and methods.  Both sprites should be Text cast members. (I can visualize the problem you describe occurring if you were transferring into a Field Cast member from a Text cast member.)

                           

                          Curious about how dynamic your application will be, Rafa. 
                          I did not experience the same problem when attempting to duplicate the scenario you described.

                           

                          Are the formatting errors introduced when you import the file?  Or were they already there in the RTF document before you imported? 

                           

                          The way I would troubleshoot is to ‘put char()’ in the message window, from just before to just after the bullet, comparing that with another Text cast member that has properly formatted text, and discover the anomaly.  It should then be easy to write a Lingo handler to detect anomalies and correct the formatting.

                           

                          Here is the syntax for text cast members, illustrated.  By creating two text cast members (“A” eh) on the stage, then go to the message window and try:

                          set T1 = the member of sprite 1

                          set T2 = the member of sprite 2

                          et T1.text ="Hello World"

                          set T2.text = T1.text

                          put char 1 of T2.text

                           

                          put the text of member 1 of castlib 1  -- or use the name of the cast member …

                          likewise:

                          put char 2 of (member 2 of castlib 1).text

                           

                          TEXT cast members are much improved over earlier versions of Director.  You used to only be able to manipulate FIELD cast members with Lingo, and the limit to a field cast member was 32kb.

                           

                          Adobe keeps on improving Director.  I wonder if Adobe will revive the Shockwave player, or build Director Shockwave into Acrobat.

                          I’ve been out of the game for a long time.  I’ve got a lot of catching up to do. 

                           

                          But try my Pokey’s Puzzle Page www.devant.com/pokey

                          • 10. Re: RTF not formating correctly
                            rafa@mediatech Level 1

                            Hi DevantEh,

                            First of all, sorry for taking so long to reply. I am definetly using the "text" tool to create a text box in the stage, which I place on the desired location. I think I am using the correct member.

                             

                            The formatting errors show as soon as I placed the RTF on the stage on my previous attemps, but the errors are definetly not present on the RTF document itself.

                             

                            thank you,

                            Rafa.

                            • 11. Re: RTF not formating correctly
                              DevantEh Level 1

                              Whichever Word Processor you are using, please be sure to "Save As RTF" from the save file format options.  Rich Text Format is compatible.

                              Errors will likely occur if you saved as ~.doc, or ~.wpf, or ~.docx.   Be sure to save as ~.rtf!

                               

                              I had some deliberately messed up bullet formatting, that I then put into a new TEXT cast member that had been instantiated on the stage, and addressed by the variable name I has assigned to the sprite, and in the transfer the formatting magically corrected itself.  My earlier post describes the steps I took.

                               

                              Curious to isolate the step at which the formatting error is introduced.  The external RTF file is formatted correctly. 

                               

                              If you open the file in WordPad, the formatting should still look correct if not a little plain (because the bullet character is just a plain dot in WordPad). 

                               

                              Are you using Microsoft Office?  Open Office Writer or Word perfect would fare no differently so long as you deliberately choose to save the files as Rich Text Format. 

                               

                               

                              • 12. Re: RTF not formating correctly
                                DevantEh Level 1

                                Hello Rafa,

                                 

                                How are you importing the RTF file?  Does the problem occur if you manually use File > Import RTF from the menu?

                                 

                                At what point does the formatting get corrupted?  Right on import?  Or do you do something with the cast member?

                                 

                                As noticed, the syntax for addressing Field cast member properties is slightly different than for addressing an RTF TEXT cast.

                                 

                                Assigning a variable to the sprite, and then addressing the properties of the sprite variable is effective.

                                 

                                I had some deliberately messed up bullet formatting, that I then put into a new TEXT cast member that had been instantiated on the stage, and addressed by the variable name I has assigned to the sprite, and in the transfer the formatting magically corrected itself.  My earlier post describes the steps I took.

                                 

                                Curious to isolate the step at which the formatting error is introduced.  The external RTF file is formatted correctly. 

                                 

                                If you open the file in WordPad, the formatting should still look correct if not a little plain (because the bullet character is just a plain dot in WordPad). 

                                 

                                Are you using Microsoft Office?  I wonder if Open Office Writer or Word perfect would fare differently. 

                                 

                                Whichever Word Processor you are using, please be sure to "Save As RTF" from the save file format options. 

                                Errors will likely occur if you saved as ~.doc, or ~.wpf, or ~.docx.   Be sure to save as ~.rtf!

                                 

                                Rich Text Format is compatible!

                                 

                                 

                                 

                                www.devant.com/pokey eh?

                                /Rob