This content has been marked as final. Show 7 replies
u can have container movieclip in stage and just unload/load it with attachMovie method(ur balls must be in library with linkage names)
from the other hand why don't have just one ball and change color via setRGB method ?
The ball_mc is just an example, the actual images are much more complex, in fact they are photographs. so the changing RGB is not an option.
Okay so to keep the analogy alive. You have a photo of a green ball and a photo of a red ball. Make each one a movieclip.
Then make a new clip called ball, in that put one of the red and one of the green. Give them instance names of red and green respectively. Make sure they line up.
Now when ever you want the red one to show:
And vice versa. You could also fade them in and out, etc. You could also use swapDepths to bring one in front of the other.
Another way to maybe approach this as you extend the number of possibilities is that you keep an array of all the choices:
Then for your buttons – and for heaven's sake stop using on(clipEvent) notation – you could have this.
Ball[myArray[ i ]]._visible=false;
That will hide them all and then make the one you want visible again.
If actual images are photographs than use unloadMovie/loadMovie .
So you you will have one container: holder_mc
and after will unload/load there your images.
That works great!
Also you mentioned that it's possible to fade the colors in and out. Is it possible to do this so that the green ball fades to red when selecting the red button while the ball is green, or would it have to fade the green out and then fade the red in?
Yes, in this case by fade, I meant fade the transparency of one or both of the clips. If you were only fading one clip you would want it to be on top. It would also require some different kind of function than the simple "hide them all then bring back the one you want." I'm not sure exactly what form it would take, maybe something the following pseudo function – by pseudo meaning I"m too lazy to work it all out, but the general steps might be:
//put current clip on top of stack and make it visible
//put new clip second in stack and make it visible, but with alpha 0
//tween the current clip's alpha to 0
//tween the new clips alpha to 100
//make the current clip (which is now the old clip) not visible when it gets to 0 alpha
You would need some variable outside of your buttons keeping track of which clip was the current one showing. Then each button would be:
Or some such.
Thanks for the help Rothrock!