How to change parent at run time?


I'm trying to change the parent objects at runtime and can't seem to get the code right, When the function "DeadBalloonBack" is run i'd like the other 2 gameObjects to become children of rhinoParentBack Any ideas would be great.

var rhinoParentFront : GameObject; 

var rhinoParentBack : GameObject; 

var rhinoRotateModel : GameObject;

var BalloonCountBack : int = 3;

 function DeadBalloonBack() {

    BalloonCountBack --;
    rhinoRotateModel.parent = rhinoParentBack; 
    rhinoParentFront.parent = rhinoParentBack; 


You have to access the parent through the object's transform, like so (the parent itself also refers to the transform of the object):

rhinoParentFront.transform.parent = rhinoParentBack.transform; 

Or for that matter:

var rhinoParentFront : Transform; 
var rhinoParentBack : Transform; 

rhinoParentFront.parent = rhinoParentBack; 

Either way would work of course.