retrieving text from jit.gl.text2d object using javascript
Hello,
I am trying to retrieve a text value from a jit.gl.text2d 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 jit.gl.text2d object:
function textLineMaker(){
if (iterator >= lineNumber +1){
kill();
}else{
iterator += 1;
a = arrayfromargs(mesagename,arguments);
textLineArray[iterator] = new JitterObject("jit.gl.text2d", "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];
textLineArray[iterator].text(a);
}
}
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);
textLineArray.shift();
}
}
not entirely sure what you are trying to do, but "text" is not an attribute of jit.gl.text2d. 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.