# Passing parameters into function - Need help

**URL:** <https://forum.kirupa.com/t/passing-parameters-into-function-need-help/125279>\
**Category:** Uncategorized\
**Created:** [October 12, 2004, 7:48am UTC](https://forum.kirupa.com/t/passing-parameters-into-function-need-help/125279 "2004-10-12T07:48:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_atkins\_gm](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@john\_atkins\_gm](https://forum.kirupa.com/u/john_atkins_gm)\
**Post date:** [October 12, 2004, 7:48am UTC](https://forum.kirupa.com/t/passing-parameters-into-function-need-help/125279/1 "2004-10-12T07:48:53Z")

</div>

In flash can we pass a MC as a parameter into a function ?  
I want to make a generic function to “shake” a movie. This would take as a param the MC shake and restore.  
My code is like this (place in frame 1 of a layer called actions).

[indent]function shake (mc:MovieClip) {  
var loop, or\_x, or\_y:Number;  
// Hold the original value of the mc position etc.  
or\_x = mc.\_x;  
or\_y = mc.\_y;  
// loop to shake the mc  
for (loop=1; loop\<10; loop++) {  
mc.\_x = or\_x+random(6)-3;  
mc.\_y = or\_y+random(6)-3;  
}  
trace(‘Out of loop.’);  
/\* Restore the mc to original values \*/  
mc.\_x = or\_x;  
mc.\_y = or\_y;  
}  
[/indent]  
This does not shake - ALTHOUGH if within an MC it works- but as i need a generic function for all …
