Function parameters

Hey all…

I am building a flash site for a client and i have come across the following problem.

I have the following script a keyframe of a swf that is loaded by a “nest” movie.



media_actions = function() {
	media.contents.onRelease = function() {
		_root.media01.swapDepths(100);
	};
	media.contents.onRollOver = function() {
		_root.media01.media.contents._alpha = 100;
	};
	media.contents.onRollOut = function() {
		_root.media01.media.contents._alpha = 30;
	};
}


So this code is meant to be a somewhat elaborate button for the movie that contains it. That is to say, this is code that is living in the movie “media01”.

I am looking at building somehting like 25 itterations of these clips, and they all have roughly the same code instructions, so i just want to build a global function that can be reffered to with a simple media_actions(); call and BOOM, no need to re-write the script.

But here is the problem. I have built the function as you can see, but when i assign a parameter to the function so that the parameter is what defines the media number, and then when i have a function call to the effect of

media_actions(media01);

Flash cannot seem to figure out what i am talking about.

I suspect this is retardo simple, and i will be slapping my head shortly.

Cheers Doods!