# \[jsfl\] get timeline

**URL:** <https://forum.kirupa.com/t/jsfl-get-timeline/62689>\
**Category:** flash\
**Created:** [August 30, 2004, 4:54pm UTC](https://forum.kirupa.com/t/jsfl-get-timeline/62689 "2004-08-30T16:54:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roady](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@roady](https://forum.kirupa.com/u/roady)\
**Post date:** [August 30, 2004, 4:54pm UTC](https://forum.kirupa.com/t/jsfl-get-timeline/62689/1 "2004-08-30T16:54:58Z")

</div>

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 =/

```auto

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 30, 2004, 5:17pm UTC](https://forum.kirupa.com/t/jsfl-get-timeline/62689/2 "2004-08-30T17:17:01Z")

</div>

hmm 😱

if I use this  
fl.getDocumentDOM().getTimeline(_timeline).addNewLayer("addedLayer_"+intNumber);

Then it creates new layers, but all the layers is created in the active movieclip I’m inside… why doesn’t this work ? :h:
