PDA

View Full Version : _visible change on var value?


baileyboop
03-16-2002, 09:23 PM
This seems like it should be easy...

I have a variable on the maintimeline that counts up to 4. When the variable is equal to 3 I want to make a movieclip visible ONLY when the variable = 3 but it isn't working. It seems to be changing the value of x on load.

Can anyone help with this?

//MCclipInstance object script visibility is set to 0 on load.

var x = 0;

if (x = 3) {
MCclipInstance._visible = 1;
} else {
MCclipInstance._visible = 0;
}

OR should I have one script on the maintimeline say
if x != 3, then MCclipInstance._visible=0 ???

Any help is appreciated. Thanks!

jimburton
03-16-2002, 09:33 PM
to compare x to 3 you need if(x==3) - saying if(x=3) is legal but actually results in flash saying:

if the result of setting x to 3 can be construed as true (which it always will)...

baileyboop
03-16-2002, 09:36 PM
Thanks. Will I need to use the eval?

if (eval(x==3)...?

-boopy

jimburton
03-16-2002, 09:50 PM
nope, eval is used to convert a string to a pathname or object reference and not needed here (BTW eval is a flash4 thing really - in F5 you're able to refer to objects as entries in an associative array which is a better way to do it - _root["pathString"].play() etc)

baileyboop
03-16-2002, 10:02 PM
Thanks. I'll give this a try.

baileyboop
03-16-2002, 10:18 PM
MCclipInstance._visible=0;
if (x ==5){
MCclipInstance._visible=1;
}

Is this correct? It doesn't seem to work.

Any thoughts?

Thank YOU!

-boopy

jimburton
03-17-2002, 07:59 PM
That certainly seems like it ought to work - check that the instances are named and that your paths are correct - that script would work when called from the main timeline with the movieclips directly on that timeline. If that doesn't solve it, post the zipped fla.