What's wrong with this script

i have this script attatched to a blank mc on it’s own layer


onClipEvent (load) {
	_root.mm.tech.setProperty._alpha = (Math.random(100))+30;
	_root.mm.design.setProperty._alpha = (Math.random(100))+30;
	_root.mm.contact.setProperty._alpha = (Math.random(100))+30;
	_root.mm.fun.setProperty._alpha = (Math.random(100))+30;
}

the paths are correct … i want the alpha to be random it’d be nice if it were between like 30 and 100 … but this is the best i can do. i don’t want it to fluctuate … just to be set once when the movie loads does that make sense

if you want to see the movie to understand better you can get it at http://www.aaronsleeper.com/bleh.fla

–edit–

i looked in the AS dictionary in the help section of Flash and i thought i should change the script to


onClipEvent (load) {
	_root.mm.tech.setProperty(_alpha, Math.random(100)+30);
	_root.mm.design.setProperty(_alpha, Math.random(100)+30);
	_root.mm.contact.setProperty(_alpha, Math.random(100)+30);
	_root.mm.fun.setProperty(_alpha, Math.random(100)+30);
}

but it’s still not working :frowning:

well i figured it out
it should look like this


onClipEvent (load) {
	setProperty("_root.mm.tech", _alpha, Math.random(100)+30);
	setProperty("_root.mm.design",_alpha, Math.random(100)+30);
	setProperty("_root.mm.contact",_alpha, Math.random(100)+30);
	setProperty("_root.mm.fun",_alpha, Math.random(100)+30);
}

but now it takes over the other actions of the buttons for my movie @#$!$@%)!@$%_) and they don’t move like they’re supposed to

sigh i’ll keep workin on it :sure:

Why use set property??? Also your Math.random statements are written wrong.

onClipEvent (load) {
	_root.mm.tech._alpha = Math.floor(Math.random()*(100-30)+30);
	_root.mm.design._alpha =  Math.floor(Math.random()*(100-30)+30);
	_root.mm.contact._alpha =  Math.floor(Math.random()*(100-30)+30);
	_root.mm.fun._alpha =  Math.floor(Math.random()*(100-30)+30);
}

You can learn more on random numbers here…
http://www.kirupa.com/developer/actionscript/tricks/random.asp

what does math.floor do … why not setProperty

beta you gotta help me with my other problem i’ve posted … it’s driving me batty

thanks :slight_smile:

and when i add that script … it still stops the other animations :frowning:

so it still doesn’t work

Your other problem is driving me batty as well.

setProperty, although still used, isn’t use as often, it is easier with the new dot syntax.

The Math.floor rounds your number down so you won’t get a value with 8 decimal places.

Math.floor() rounds down
Math.ceil() rounds up
Math.round() rounds off, but I think this one makes certain random numbers occur more often. I forget the EXACT reason floor is used more often. Senocular posted a lengthy explanation on this, if I find the thread, I will post it.

Here is Sens excellent explanation on Random Numbers… Kirupas tutorial is good too.

http://www.kirupaforum.com/showthread.php?s=&threadid=11686