Forums > Jitter

retrieving text from object using javascript

Dec 01 2009 | 1:19 am


I am trying to retrieve a text value from a object that I have assigned in javascript. The texts are generated from a line from a txt file and are added t the text2d by using an arrayfromargs. However, while I can assign the text to an object, I seem to be unable to figure out how to retrieve the text. Here is the code that creates the object:

function textLineMaker(){
    if (iterator >= lineNumber +1){
        iterator += 1;
        a = arrayfromargs(mesagename,arguments);
        textLineArray[iterator] = new JitterObject("", "textWindow");
        textLineArray[iterator].antialias = 1;
        textLineArray[iterator].align = 1;
        textLineArray[iterator].color = [1,1,1,0.4];
        textLineArray[iterator].automatic = 1;
        textLineArray[iterator].position = [0,1,0];

here is the code I am using to try and extract the text. All I get is a null value. Any help would be greatly appreciated (especially since my brain is fried.

function unloadTextAndRead(){
    var i = textLineArray[0].position[1];
    i -= 0.01;
    textLineArray[0].position = [0.0, i, 0.0];
    if (textLineArray[0].position[1] < -0.9){
        var textToRead = textLineArray[0].text(messagename);
        outlet (0, "read "+ textToRead);

Dec 01 2009 | 5:49 pm

not entirely sure what you are trying to do, but "text" is not an attribute of it’s a message, which means it doesn’t have a value that can be read back.

you will have to store your lines of text yourself using something like an array.

Viewing 2 posts - 1 through 2 (of 2 total)

Forums > Jitter