Pausing Help

I’m currently trying to write some code that pauses an animation I trigger with a button, but when I make a separate file for pausing the animation, it doesn’t do anything. The same code does, however, work when I paste it into the same javascript file, although that means clicking on the cube calls two different functions at once, and is really finicky and is not what I need to happen. Here’s my code:

For triggering the animations:

var kmaster : Transform;

function OnMouseUp()
{
	if (kmaster.animation.IsPlaying("whiteIdle"))
	{
		kmaster.animation.Play("white");
		kmaster.animation.PlayQueued("whiteIdle", QueueMode.CompleteOthers);
	}
	if (kmaster.animation.IsPlaying("orangeIdle"))
	{
		kmaster.animation.Play("orange");
		kmaster.animation.PlayQueued("orangeIdle", QueueMode.CompleteOthers);
	}
	if (kmaster.animation.IsPlaying("purpleIdle"))
	{
		kmaster.animation.Play("purple");
		kmaster.animation.PlayQueued("purpleIdle", QueueMode.CompleteOthers);
	}
	if (kmaster.animation.IsPlaying("blackIdle"))
	{
		kmaster.animation.Play("black");
		kmaster.animation.PlayQueued("blackIdle", QueueMode.CompleteOthers);
	}
	Debug.Log("Attack!");	
}

For pausing the animations

var kmaster : Transform;

function OnMouseUp()
{
	if (kmaster.animation["white"].speed == 1)
	{		
		kmaster.animation["white"].speed = 0;;
	}
	else
	{
		kmaster.animation["white"].speed = 1;
	}
	if (kmaster.animation["orange"].speed == 1)
	{		
		kmaster.animation["orange"].speed = 0;;
	}
	else
	{
		kmaster.animation["orange"].speed = 1;
	}
	if (kmaster.animation["purple"].speed == 1)
	{		
		kmaster.animation["purple"].speed = 0;;
	}
	else
	{
		kmaster.animation["purple"].speed = 1;
	}
	if (kmaster.animation["black"].speed == 1)
	{		
		kmaster.animation["black"].speed = 0;;
	}
	else
	{
		kmaster.animation["black"].speed = 1;
	}
}

Any help would be appreciated!

Please use ‘code’ tags when posting code.

Could you explain a little more thoroughly what you are trying to accomplish? It isn’t clear from your code.