# FLV Help needed: combining onStatus and onMetaData code

**URL:** https://forum.kirupa.com/t/flv-help-needed-combining-onstatus-and-onmetadata-code/249246
**Category:** flash
**Created:** [January 16, 2008, 10:00pm UTC](https://forum.kirupa.com/t/flv-help-needed-combining-onstatus-and-onmetadata-code/249246 "2008-01-16T22:00:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Holland\_Oats](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Holland\_Oats](https://forum.kirupa.com/u/Holland_Oats)
#### Post date: [January 16, 2008, 10:00pm UTC](https://forum.kirupa.com/t/flv-help-needed-combining-onstatus-and-onmetadata-code/249246/1 "2008-01-16T22:00:13Z")

</div>

i have two snippets of AS2 code that don’t get along. one piece lets a set of videos play sequentially (see snippet A below), and the other piece helps run a custom video player (snippet B). both sets have onStatus and onMetaData information that i somehow need to rewrite, restack, or collate. any help would be very much appreciated, thanks!!

```auto
SNIPPET A (sequential playback)

ns.onMetaData = function(evt:Object):Void {
  duration = evt.duration;
  ready = true;
};

ns.onStatus = function(evt:Object):Void {
  if (ready && this.time > 0 && this.time >= (duration - 0.1)) { //changed from 0.5
    ready = false;
    currentVideo++;
    if (currentVideo < videos.length) {
      ns.play(videos[currentVideo]);
    } else {
      delete this.onStatus;
    }
  }
}

SNIPPET B (custom player control)

ns.onStatus = function(info) {
    if(info.code == "NetStream.Play.Start") {
        progressBar.onEnterFrame = videoUpdate;
    }
    if(info.code == "NetStream.Play.Stop") {
        delete progressBar.onEnterFrame;
    }
}

ns.onMetaData = function(info) {
    ns.duration = info.duration;
}

```
