# Multiple onMetaData?

**URL:** <https://forum.kirupa.com/t/multiple-onmetadata/310084>\
**Category:** Uncategorized\
**Created:** [June 1, 2010, 7:23am UTC](https://forum.kirupa.com/t/multiple-onmetadata/310084 "2010-06-01T07:23:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [June 1, 2010, 7:23am UTC](https://forum.kirupa.com/t/multiple-onmetadata/310084/1 "2010-06-01T07:23:44Z")

</div>

I have a correctly working FLV video play. But now I need to make it load “infinite” videos in “infinite movieclips” at the same time. And that’s where it get tricky.

Obviously I can’t duplicate or copy-paste infinite metaDataHandler() functions.

I thought of creating nested Arrays to take the place of the metaDataHandler function. So I nested a number of array variables (object[][], metaDataHandlerArray[][] and VIDEOduration[][]) to prepare it.

In short i have now the following. “j” represents ‘movieclip’ and “k” represents one of multiple videos in each movieclip. It performs a for() loop for “k”, within a for() loop for “j” and within that is the video and meta data part.

```auto

...
object[j][k].onMetaData = metaDataHandlerArray[j][k];
...

```

and in the array-function I have

```auto

...
metaDataHandlerArray[j][k] = function (data:Object){
     VIDEOduration[j][k] = data.duration;
     trace(VIDEOduration[j][k] +" j="+j+" k="+k)
}
...

```

Now it almost traces/works correct… almost. I test with one MC with 2 videos, it traces

10.3 j=1 k=2  
9.933 j=1 k=2

So what seems to be happening is weird. It does read two different durations for the videos but reads the same value for ‘k’. It should trace 1 and 2 but it traces 2 and 2.  
If I place a trace(k) before metaDataHandlerArray[j][k] and indeed it traces 1 and 2 before the traced lines above so I’m 99% positive the loops finish/complete before the meta data is read/set

Anybody any clue how to solve this?  
P
