Apply movie as texture using TextureSwapAnimator.js

I am new to scripting and wanted to know how to apply a movie to a cube using the given code:

var frames : Texture2D[];

var framesPerSecond = 10.0;

function Update () {

var index : int = Time.time * framesPerSecond;
index = index % frames.Length;
renderer.material.mainTexture = frames[index];

}

I have a movie that I rendered out to a series of images called movieImage_001...and so on. I am confused as to what the next step should be.What , if anything, should be changed in this script and what do I do with the images?

Thanks

I figured it out for any future new scripting users. Here is the very simple solution:

Paste the code in a new javascript file -save that file -drag it to your object -in the inspector window, set the frames per second and increase the number of frames to match how many images are in the movie. -this creates an individual slot for each image, which you drag each one in order to each slot.