View Full Version : Setting variable text with a condition loop
I'm trying to set some variable text once three MCs are dropped on to their target. I can get it working once one is dropped but by adding the set variable to the conditions attached to the movie clip. What I thought would work to add the following code to the first frame of the movie.
ifFrameLoaded (1) {
}
{
if ((_root.aluminium == "/targetgreen") && (_root.plastic == "/targetgreen") && (_root.red == "/targetgreen")) {
text = "Well done, you got all three right";
} else {
text = "";
}
}
The 'else' variable works but not the 'if'.
Please help, what am I doing wrong. Probably something very simple, but I am a Newbie so be kind.
matt poole
08-19-2003, 09:10 AM
well you dont need the extra "()" round the conditiopns in the if for a start (use AS tags in your post, it makes it easier to read :))
ifFrameLoaded (1) {
}
{
if (_root.aluminium == "/targetgreen" &&_root.plastic == "/targetgreen" && _root.red == "/targetgreen") {
text = "Well done, you got all three right";
} else {
text = "";
}
}
Thanks for the reply. It's still not working though.Could the AS on my other MCs be stuffing it up or am I not using the apropriate Action before the 'if'.
I've tried a few things, none of which seem to be working.
Any other ideas? :confused:
Here's the swf if that's any help.
myrn
matt poole
08-20-2003, 08:58 AM
you could just test for something else. Say if you make the MC _visible = false when they hit the drop target, you could do it like this:
if (_root.aluminium._visible == false &&_root.plastic._visible == false && _root.red._visible == false) {
text = "Well done, you got all three right";
} else {
text = "";
}
matt poole
08-20-2003, 11:59 AM
Hi I've knocked together a quick example of how I might have done what your doing, you'll probably have hack it a bit to make it fit, but hopefully it'll give you some ideas...
Choice! Thanks for this. Still haven't quite got my head around the AS but I'll have a play and see if I can get it working for my game.
Myrn
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.