retrieving text from object using javascript

Dec 1, 2009 at 1:19am

retrieving text from object using javascript


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 1, 2009 at 5:49pm

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.


You must be logged in to reply to this topic.