# Function parameters

**URL:** <https://forum.kirupa.com/t/function-parameters/170257>\
**Category:** Uncategorized\
**Created:** [November 24, 2005, 3:56am UTC](https://forum.kirupa.com/t/function-parameters/170257 "2005-11-24T03:56:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie\_geek](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@newbie\_geek](https://forum.kirupa.com/u/newbie_geek)\
**Post date:** [November 24, 2005, 3:56am UTC](https://forum.kirupa.com/t/function-parameters/170257/1 "2005-11-24T03:56:47Z")

</div>

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.

```auto

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!
