PDA

View Full Version : Small scripting problem ...


Reflex
03-28-2003, 02:54 AM
When testing for a numerical equality you use this:

if (_root.iamaclip.iamavariable == 4) {
_root.iamanotherclip._visible = false;
}

But what about letters ?. Should this work in the same way:

if (_root.iamaclip.iamavariable == hello) {
_root.iamanotherclip._visible = false;
}

or should it be this:

if (_root.iamaclip.iamavariable == "hello") {
_root.iamanotherclip._visible = false;
}

or something else all together ?.


Thanks,
Stephen.

Shashank
03-28-2003, 03:06 AM
if (_root.iamaclip.iamavariable == "hello") {
_root.iamanotherclip._visible = false;
}

is the right....code....
But there r many other way also...

Mortimer Jazz
03-28-2003, 03:06 AM
Yes, if it's letters (strings) you put them in quotes. The only exception is for keywords such as the boolean values true and false which have no quotes around them.

[edit - sorry Shashank, we must have posted at the same time :) ]

Reflex
03-28-2003, 03:12 AM
single quotes: 'word'

or

double quotes: "word"


Thanks again.

Mortimer Jazz
03-28-2003, 03:15 AM
I don't think it matters, but the norm is to use double quotes.

Shashank
03-28-2003, 03:24 AM
the boolean values true and false are never in cots..i mean "
in any language

OK!!!
If still not working then check the script above it,,,,