Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[AS2]problem with random image shower
#1
as the title says i have a problem with a image shower

i have 3 movieclips and one button

instance names are eye1 eye2 eye3 (the moviclips) and submit (button)

the code

    ACTIONSCRIPT-Code:
eye1._alpha = 0;
eye2._alpha = 0;
eye3._alpha = 0;
submit.onRelease = function() {
	num == Math.ceil(Math.random()*2)
	if (num == 0) {
		eye1._alpha == 100;
		eye2._alpha = 0;
		eye3._alpha = 0;
	} else if (num == 1) {
		eye2._alpha == 100
		eye1._alpha = 0;
		eye3._alpha = 0;		
	} else if (num == 2) {
		eye3._alpha == 100
		eye1._alpha = 0;
		eye2._alpha = 0;		
	}
};
Reply
Thanks given by:
#2
eye1._alpha == 100;
should be
eye1._alpha = 100;

same goes for the other eye2 and eye3 in the other if blocks, plus the ";"s. (if i'm wrong it's coz i've never done AS)



Azriel~
Reply
Thanks given by:
#3
code still not working

updated one
    ACTIONSCRIPT-Code:
eye1._alpha = 0;
eye2._alpha = 0;
eye3._alpha = 0;
submit.onRelease = function() {
	num == Math.ceil(Math.random()*3)
	if (num == 1) {
		eye1._alpha = 100;
	}
	if (num == 2) {
		eye2._alpha = 100;		
	}
	if (num == 3) {
		eye3._alpha = 100;	
	}
};
Reply
Thanks given by:
#4
num == Math.ceil(Math.random()*3)
should be
num = Math.ceil(Math.random()*3)

x == y means "does x have the same value as y"
x = y means put y's value into x

I'd leave the eyeX.alpha = 0 in the if blocks (where X is not the one u're enabling).



Azriel~
Reply
Thanks given by:
#5
nvm i forgot a instance name
*presses solved button*
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)