[jsfl] get timeline

Hi everyone…
I’m trying to learn jsfl-script. What I have done is a script that loops thru the whole library, then loop thru the timeline and when I find a textField I want to set a keyFrame and some actions there.

I have manage so far to get to the textField, but then, how do I put the keyframe ???
Don’t really understans MM;s description in the reference.

What I have to work is:
_timeline = this is the mc the stuff is in
_frame = on what frame are we on
_elements = all the stuff that is on that frame

the reference tell me to use this
fl.getDocumentDOM().getTimeline().addNewLayer();

But when I use it everything is created in the root, don’t really know how to make it go into the correct mc =/


function checkElements(_elements, _frame, _timeline){
	for (var i in _elements){
		if(_elements*.elementType=="text"){
			if(_elements*.name==""){
				_elements*.name = "addedText_"+intNumber;
			}
			intNumber +=1;

			// Here I need to create a keyframe
			// would be great to do it in a new layer
		}
	}
}

best regards
// B