From: nkandili on
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:

[b]Example A[/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").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]
-- ""

[b]Example B[/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()...

From: Sean Wilson on
> [b]Example A[/b]
>
> -- 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

> [b]Example B[/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[i], 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[i] = "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.
From: nkandili on
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


From: McFazstp on
Maybe you could use hyperlinks instead of pointToLine?

From: nkandili on
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!!