Forums > Javascript

return value

November 13, 2010 | 4:12 pm

Hi Guys,

I’m trying to send a value to a live object. I get a message that object doesn’t understand the message. But if i send the same thing from a ‘normal’ messagebox it works just fine. So after some tests it seems the js object is returning the text wrapped in quotes and the object doesn’t like that. Anyone know if this is correct and if there’s a work around?

Thanx!!!
wouter



pid
November 13, 2010 | 4:31 pm

scratch that


November 14, 2010 | 10:20 am

If I understand your question correctly, a fromsymbol connected to your js output may help your other object to understand the message.

p


November 14, 2010 | 9:43 pm

To do it in your javascript you need to send out the message as an array of inividual strings:

outlet(0,"like","this","instead");


November 24, 2010 | 4:21 pm

thanx guys! that solves my question!!


October 1, 2011 | 2:54 pm

I came upon the same problem. I want to send a message to a line object like "0, 5 100", but there appears to be no way to put the comma in there. There is a work-around (replace the comma with a 0 so that it goes immediately to the first break-point), but I feel as though there ought to be a way to actually send the message "0, 5 100" to a line~ object. I thought I could beat the system by making an Array where the second element was a string ", ", but THAT string gets wrapped with quotes as well, producing nonsense: ’0 ", " 5 100′!

If I wanted to tell a message box to change what it displays with a set message, how could I do it? How could I set a message box to say "hello world"? Of course, I could say outlet(0, "set", "hello", "world"), but suppose that the message I wanted to display would be determined by the code, having a variable number of words? This can’t be impossible, can it?


October 2, 2011 | 7:53 pm

To replicate the action of sending "0, 5 100" in javascript you would do something like this:

outlet(0, 0);
outlet(0, 5, 100);

On the second point you can always create an array to contain the symbol arguments and then add/remove/whatever them and refer to the array:

var someWords = ["hello","world"];
outlet(0, someWords);

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