looping through object parameters

today i wanted to be able to pass an object into a function and have it apply the parameters of the object to my custom movieclip class, so I needed to loop through an object's paramters and attribute them to the movieclip's parameters.


var obj:Object = {param1:"myfirstparamvalue"}
for(var i in obj){
trace(i); //output: param1
trace(obj[i]); //output: myfirstparamvalue
}

so then we can just do this:

for(var i in obj){
MovieClip(myMovieClipWithTheseParams)[i] = obj[i];
}

this is assuming of course that 'myMovieClipWithTheseParams' has whatever parameters you are updating set as public in it's class.