Animation Event for Mecanim

I figured out that I can use animation events for my mecanim character.

Well the problem is that I’ve made an event, but I don’t have any idea how to use it in JavaScript.

I made at time 0.17 a function called “TakeOver”

And a float set up to “1”

And in my JavaScript, I used this

var Weapon : GameObject;
var Spine : GameObject;
var Hand : GameObject;

function TakeOver ()
{
   if (TakeOver == 1)
   {
      Weapon.transform.parent = Hand.transform;
   }
   else
   {
      Weapon.transform.parent = Spine.transform;
   }
}

But this is not working. Someone who can help me out with this problem? (I’m nearly driving crazy)

Thanks in advance!

Try this code:

function TakeOver (myFloat : float) {
   if (myFloat == 1.0)
    {
       Weapon.transform.parent = Hand.transform;
    }
    else
    {
       Weapon.transform.parent = Spine.transform;
    }
}