6 Replies Latest reply on Apr 14, 2008 7:16 PM by stephen_

    Director 11 line.count problem?

    nkandili
      Hi all. My name is Natassa and this is my first time here!

      I am not new with Director, but can't figure out the following!

      There seems to be something wrong when working with text members regarding the line.count property. In our project, i parse through XML files and store data in text members which are placed on stage and run a mouseOver script using pointToLine(the mouseLoc) in order to change the color of the "active" line of the text member.
      The XML files are all utf-8 encoded, since we have english, greek and french text.

      I use a repeat loop so as to fill a text member with some titles.
      I have tried everything i could think of and could not solve my problem. So, i thought i should try something very basic and figure out what is going on.

      Nothing seems to be working!

      I have run the following basic scripts with the following output:

      Example A

      script:
      --I use numToChar(940) which is a greek character, since in our project we have english, greek, french all utf-8 encoded
      member("myText").text=""
      repeat with i=1 to 300
      myString = " line " & numToChar(940) & numToChar(940) & numToChar(940) & numToChar(940) & i
      member("myText").line[ i ] =myString
      put i,member("myText").line[ i ], member("myText").line.count
      end repeat

      Message window output:
      -- 1 " line άάάά1" 1
      -- 2 " line άάάά2" 2
      .
      . (everything ok so far)
      .
      -- 232 " line άάάά232" 232
      -- 233 " line άάάά233" 233
      -- 234 " line άάάά234" 208
      -- 235 "" 235 HERE IS THE PROBLEM - NO STING STORED IN THE TEXT MEMBER AFTER THIS LINE
      -- 236 "" 236
      -- 237 "" 237
      .
      .
      .
      -- 299 "" 299
      -- 300 "" 300

      put member("myText").line.count
      -- 300
      put member("myText").line[300]
      -- ""

      Example B

      script:
      --I use numToChar(940) which is a greek character, since in our project we have english, greek, french all utf-8 encoded
      member("myText").text=""
      repeat with i=1 to 300
      myString = " line " & numToChar(940) & numToChar(940) & numToChar(940) & numToChar(940) & i
      member("myText").setContentsAfter(RETURN & myString)
      put i,member("myText").line[ i ], member("myText").line.count
      end repeat

      Message window output:
      -- 1 " line άάάά1" 2
      -- 2 " line άάάά2" 3
      .
      . (everything ok so far)
      .
      -- 232 " line άάάά232" 233
      -- 233 " line άάάά233" 234
      -- 234 " line άάάά234" 209 HERE IS THE PROBLEM - line.count DOES NOT WORK CORRECTLY
      -- 235 " line άάάά235" 210
      .
      .
      .
      -- 299 " line άάάά299" 274
      -- 300 " line άάάά300" 275

      put member("clippings").line.count
      -- 275
      -- But if i copy the text of the member and paste it into a text editor, there are 300 lines!!!

      put member("clippings").line[300]
      -- " line άάάά300"

      As a result, the pointToLine(the mouse Loc) is not working well! The mouse is over a line and a different line has the "active" color...


      As you can see, the problem occurs after line 234!! :-|
      Does anyone else have the same problem? I have a deadline and can't figure out what to do!!

      p.s. I updated a director MX file to a director 11 file. A text member (contains greek and latin characters) opened in MX has a line.count of 384 (correct) and the same member opened in 11 gave a line.count of 275!!!!! Again the same problem with pointToLine()...
        • 1. Re: Director 11 line.count problem?
          Level 7
          > Example A
          >
          > -- 233 " line ????233" 233
          > -- 234 " line ????234" 208
          > -- 235 "" 235 HERE IS THE PROBLEM - NO STING STORED IN THE TEXT MEMBER
          > AFTER THIS LINE

          FWIW: I can replicate this problem, and it doesn't occur in DMX2004, so
          it's a new bug. It seems that line 234 gets the line number wrong (208)
          and it all turns to custard after that

          > Example B
          >
          > -- 232 " line ????232" 233
          > -- 233 " line ????233" 234
          > -- 234 " line ????234" 209 HERE IS THE PROBLEM - line.count DOES NOT WORK
          > CORRECTLY
          > -- 235 " line ????235" 210

          And I can replicate this too.


          However, I can "fix" your second example by referencing member.text.line
          instead of member.line. See the following alteration to your original
          handler:
          on test2
          member("myText").text=""
          c = numToChar(940)
          s = "line " & c & c & c & c
          repeat with i=1 to 300
          member("myText").setContentsAfter(RETURN & s & i)
          put i, member("myText").text.line , member("myText").text.line.count
          end repeat
          end

          I can't find a fix for your first example in a similar fashion. It's not
          permitted to execute member("myText").text.line
          = "string"

          > As a result, the pointToLine(the mouse Loc) is not working well! The mouse is
          > over a line and a different line has the "active" color...

          > p.s. I updated a director MX file to a director 11 file. A text member
          > (contains greek and latin characters) opened in MX has a line.count of 384
          > (correct) and the same member opened in 11 gave a line.count of 275!!!!! Again
          > the same problem with pointToLine()...

          Try instead measuring member.text.line.count instead of member.line.count

          I will try to replicate the pointToLine() issue and see if I can find a
          workaround.
          • 2. Re: Director 11 line.count problem?
            nkandili Level 1
            Thanks you very much for the response!

            I have also noticed that member("someTextMemberName").line.count gives a different line count than member("someTextMemberName").text.line.count!? It is so weird. And everything works fine on MX. And to imagine that the only reason we upgraded to 11 is because of the unicode antialiased text in 11 (we have greek, french and english).

            I will be waiting for an answer for pointToLine! It is very important for our project, since our text members are basically links (each line points to a different id)...

            Thanks again.

            Natassa
            • 3. Re: Director 11 line.count problem?
              McFazstp Level 1
              Maybe you could use hyperlinks instead of pointToLine?
              • 4. Re: Director 11 line.count problem?
                nkandili Level 1
                Unfortunately, hyperlinks won't do the trick for us... We have scrolling text members (with a line count of over 300) on stage and i need to add affect to the "active line" (from pointToLine which does not work...).

                If anyone can help, please do!!
                • 5. Re: Director 11 line.count problem?
                  stephen_ Level 1
                  Is pointToChar working?

                  char_num = sprite( 1 ).pointToChar( _mouse.mouseLoc )
                  char_loc = sprite( 1 ).member.charPosToLoc( char_num )
                  line_num = sprite( 1 ).member.locVToLinePos( char_loc.locV )

                  • 6. Re: Director 11 line.count problem?
                    stephen_ Level 1
                    Or maybe mapStageToMember?

                    char_loc = sprite( 1 ).mapStageToMember( _mouse.mouseLoc )
                    if ilk( char_loc, #point ) then
                    char_locV = char_loc.locV + sprite( 1 ).member.scrollTop
                    line_num = sprite( 1 ).member.locVToLinePos( char_locV )
                    end if