[Xerte] Re: Accessing breakApart() words

Kent Chesnut kent_chesnut at hotmail.com
Wed Jan 23 01:21:46 GMT 2013



Julian,

Thanks for you input.

I added a button with the following script

w[0].setText("Test " + p);
p++;
debug(p);

where p is initialized to 0 in earlier script.

Here's the earlier script (attached directly to the page)

w = IdPrayer.breakApart(25, 5, true, false);
t = new Array(200);      // Array t is used to keep track of which words have been replaced.
for(i=0; i<200; i++)
{
    t[i] = -1;                 // -1 designates the original text is in the word
}

p = 0;


As I press the button multiple times, the word only changes to "Test 0".

The debug window shows that p is increasing.  Therefore, I know the script is executing with each button press but that the value of w[0] only changes on the first button press.

I noticed I was running Xerte 2.16 so I uninstalled using the control panel and re-installed 2.18.  This made no difference.

BTW - this is not of great importance.  Don't turn this into a time killer.  But if you have any suggestions for me to try, please let me know.

Have a great evening,
Kent


From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
Date: Tue, 22 Jan 2013 15:24:54 +0000
Subject: [Xerte] Re: Accessing breakApart() words

WORDs have set text which will set the text. I don’t see why that would stop working: is wordClicked the problem, rather than setText() – can you try calling setText() on w[0] through a button press several times to see if it fails? From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Kent Chesnut
Sent: 22 January 2013 01:42
To: Xerte Lists
Subject: [Xerte] Accessing breakApart() words All,

I use breakApart() to convert a text field into a series of movie clips.

    w = IdPrayer.breakApart(25, 5, true, false);

I am then able to access the text and the index of a word when it is clicked.

    Txt = IdPrayer.wordClicked.text;
    Index = IdPrayer.wordClicked.index;

I am able to replace the text

    IdPrayer.wordClicked.setText(rep);

However, I am only able to set the text 1 time.  And although the word changes on the screen, IdPrayer.wordClicked.text has the original string in it when I click the modified word.  If I try to change the text a second time, nothing happens.

    IdPrayer.wordClicked.setText("Something else");


I'm guessing that setText() is not what I should be using here... but haven't found what I should be using.

Thanks in advance for any help you can provide.

Have a great evening,
Kent





_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20130122/585a48c5/attachment.html>


More information about the Xerte mailing list