Easy (I hope!) js scripting conversion problem...

Chuck T wrote on 1/10/2012, 1:35 PM
Here's a simple Vegas 10 js script which opens a specific project, mutes the first track in the project, then resets the PositionY property of the first keyframe in TrackMotion for the 2nd track in the project:

import Sony.Vegas;
Vegas.OpenProject("G:\\LW_VEGAS_FRAMES\\F0077.VEG");
var i=0;
var trackEnum : Enumerator = new Enumerator(Vegas.Project.Tracks);
while(!trackEnum.atEnd())
{var track : Track = Track(trackEnum.item());
if(i==0) track.Mute=true; //mute the first track to remove captions
if(i==1) //for 2nd track, reset PositionY of 1st keyframe in TrackMotion
{var myTrack : VideoTrack = track;
var kf = myTrack.TrackMotion.MotionKeyframes[0];
kf.PositionY=0.0; //reset Y
}
trackEnum.moveNext();
++i;
}

This actually works, except Vegas 10 reports an error: "This conversion may fail at runtime." for the line: var myTrack: VideoTrack =track;

As you can see, I am a newbie at js; could someone kindly tell me what's wrong with this line?
Thanks! -chuck