[javascript-dev] Re: JSUI : question about Array index/value
Emmanuel Jourdan
c74-mailinglists at e--j.com
Thu Oct 4 02:08:59 MDT 2007
- Previous message: [javascript-dev] Re: JSUI : question about Array index/value
- Next message: [javascript-dev] Re: JSUI : question about Array index/value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4 oct. 07, at 09:18, Salvator wrote:
> Thanks, It works !!
>
> Emmanuel,
> I'm nt sure to understand ... You mean just adding "var i=0" inside
> the function ?
if you don't use the var keyword, the variable is automatically
declared as global (in the JavaScript meaning, not the Global
object). And it's usually very hard to figure out the problem (for
example, if you have 2 jsui running at the same time, they will share
the i variable, which is really not what we want in such situation).
> Any idea about my question #2 :
> Actually I have to pass a message with a prefix "ratio 3:1" , to
> enter the function ratio(input).
>
> Is there anyway to make it work just by sending a single symbol
> "3:1" ? Is it possible at all to send single symbol message to jsui ?
Have a look to the anythinng() method. The message name property
should have the symbol "3:1". Although I didn't test, the following
should work:
var Ratio = ["1:1", "2:1", "3:1","4:1", "6:1", "10:1"];
function anything()
{
var i; // this is really important ;-)
for(i = 0; i < Ratio.length; i++) {
if(Ratio[i] == messagename)
outlet(0, i);
}
}
ej
- Previous message: [javascript-dev] Re: JSUI : question about Array index/value
- Next message: [javascript-dev] Re: JSUI : question about Array index/value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
