I wana make it like if red n free button is press.. thn the output movieclip will b yellow..this coding doesn't work..
i have no idea.. how the coding should be..
please HELP me.. =D
Hello! Your code contains alot of flaws. I'm not sure how good you are with Actionscript, but I'll try to help you
And since when was it possible to click 2 buttons at once with only 1 cursor xD?
Now, from what I understand, you have 2 Buttons, and 3 Movieclips, with the colors Green, Red, and Yellow. You want all of them to be invisible at first. When you click on a button, a movieclip will appear (either green or red, depending on the button you clicked on) with the _visible code. If both of the buttons are active, meaning that both the green and the red movieclips are _visible, the yellow movieclip should appear, right?
I made 2 Buttons (one for the Green mc, and the other for Red mc). Then I made 3 Movieclips, for the colors green, red and yellow, and I put the Yellow Movieclip above the Green and Red mc's (cause if I don't do that, then the Yellow MC won't be visible -.-*). Then I simply wrote this code on one of the Frame Actions:
_root.green._visible = false;
_root.red._visible = false;
_root.yellow._visible = false;
// this will make the buttons invisible once the movie starts
var green_var:Boolean = false;
// this is a variable which only contains 2 values,
// false or true
var red_var:Boolean = false;
// same for this one
btnGreen.onPress = function(){
green_var = !green_var;
// when Green button is clicked, green_var which is false at first,
// will turn into the opposite, which would then be true,
// because a Boolean only contains either false or true ;)
// if we know click on this button again, the variable
// green_var will turn from true to false. This is just to simplify
_root.green._visible = !_root.green._visible;
// since _visible also only has 2 values, true and false, we can
// use ! exclamation mark to turn it into the opposite of what it
// is right now. It is from the start, set to false, so when we
// click on this button, it will be set to true. It will be visible
}
btnRed.onPress = function(){
red_var = !red_var;
// same as above, this time, we have an individual variable for red
_root.red._visible = !_root.red._visible;
}
onEnterFrame = function(){
// onEnterFrame will make the codes under loop, so that they
// check that the WHOLE time, if those two are true or not
// or else they would only have checked at the start of the movie
if(green_var == true && red_var == true){
// if the variables green_var AND red_var are both set to true,
// then execute the following codes
_root.yellow._visible = true;
// make yellow mc visible
} else {
// if green_var AND red_var are both NOT true at the same time
// then execute the following code
_root.yellow._visible = false;
// make yellow mc invisible
}
}
If you still do not understand, or do not like this code, you can always use another n00bish way xD, here:
btnGreen.onPress = function(){ if(_root.green._visible == false){ // when button is clicked, if green mc is false, // then set it to true _root.green._visible = true; }else{ // if not, then make it false. Which means that if // _root.green._visible is not equals to false, but // in this case, it is equals to true, then make it false _root.green._visible = false; } }
btnRed.onPress = function(){ // same below as above if(_root.red._visible == false){ _root.red._visible = true; }else{ _root.red._visible = false; } }
onEnterFrame = function(){ if(_root.green._visible == true&&_root.red._visible == true){ // if green is visible AND red is visible at the same time _root.yellow._visible = true; // make yellow mc visible }else{ // or else _root.yellow._visible = false; // make yellow mc invisible } }
Use the one you find the most suitable for your level
Hope this Helps. If you need more help, please, go ahead and ask
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS