onMetaData gets triggered multiple times?

Hi! First, I’ll admit I’m new to working with NetConnections and NetStreams, so please, bear with me.

I have a class set up that should just spit back the duration of a loaded video file. It works, but my onMetaData handler seems to get triggered twice, even though I can only see one place that should trigger it:


public function PENetConnection (obj:Object=null)
        {
            // Create object to hold metadata.
            meta=new Object();
            
            // Assign path.
            videoURL=obj.filename;
            
            nc=new NetConnection();
            nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEvent);

            nc.connect(null);
        }
        
        private function onNetStatusEvent (evt:NetStatusEvent):void
        {
            trace (evt.info.code);
            
            switch (evt.info.code) {
                case "NetConnection.Connect.Success":
                connectStream();
                break;
                
                case "NetStream.Play.StreamNotFound":
                trace ("Stream not found: "+videoURL);
                break;
            }
        }

private function connectStream ():void
        {
            ns=new NetStream(nc);
            
            ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEvent);
            ns.client=meta;
            meta.onMetaData=metaHandler;
            
            //*
            video.attachNetStream(ns);
            ns.play(videoURL);
            ns.pause();
            //*/
        }
        
        private function metaHandler (obj:Object):void
        {
            var p:String;
            for (p in obj) {
                trace (p+": "+obj[p]);
            }
            trace ("----------");
            trace (videoURL, ": duration:", clockify(Math.floor(obj.duration)));
            trace ("==========");
        }

Most of that was stolen from the example in the AS3 documentation…

Can anyone tell me what might be causing metaHandler (my onMetaData replacement) to fire twice? :frowning: Thanks in advance!