you can use the _visible property of movieclips to show (mc._visible=true) and hide (mc._visible=false) a movieclip mc.
1 person found this helpful
Probably not if/else statements. They are great when you have a couple of choices, but as things get bigger the possible combinations explode and the code gets far to complex. Not that it can't be done, but it is messy, prone to error, and likely to become a nightmare. In this case I would probably recommend the clever use of MovieClip parents and arrays.
So, I'm going to assume a fairly static design -- meaning that you have, say 10 different shirts, and you aren't going to be changing those 10 or adding new ones all the time. Even if this isn't the case it is a good starting point for making what you will need.
So make a new movie clip called, "Shirts." In that clip you can arrange your artwork (which most likely will also be movieclips).
Do the same things for one called, "Shoes," another called "Pants" and so on.
Of course you will want to design what these clips look like, they should probably be the same shape and size and maybe have a background or not. I don't know. Doesn't matter.
Put each of those clips on your stage. Give them instance names like "shirts," "shoes," and "pants." (I name my clips in my library with capital letters and my instances with lower case. It makes it easy to tell what is what. Just an idea....) You might want to put each one on a layer and stack them all up. The layers make it easier to hide/show a layer an manipulate stuff.
Now add some code to a frame:
Then whenever you need to show a specific group of items you can first call the hideItems() function to hide all of them. And then unhide the one that you do want to show.
Or perhaps an even easier way would be to still make clips for each type of thing. Then make a new movieclip of all the items, but with each item on a separate frame. You could then send that movieclip to that specific frame. Or you could space them out, say put 10 frame or so between each keyframe and each keyframe has one of the different movieclips. You could then add frame labels and have that clip jumpt to which ever type of item it needed to show.
Both of these are pretty easy ways to do it and they don't get that much more complex if you suddenly need to add a "pocket square" category. But try doing that with if/else...yikes!