6 Replies Latest reply on Apr 25, 2009 6:44 AM by kglad



      This line of code (that worked in previous versions of Flash) is not working in CS4. Does anyone know how I need to write it?


      ns["onMetaData"] = function(obj){
          duration = obj.duration;


      If anyone knows, I'd appreciate a heads up. Thanks!

        • 1. Re: onMetaData
          kglad Adobe Community Professional & MVP

          that should work if you define ns correctly as your netstream instance.  did you?

          • 2. Re: onMetaData
            izdo89 Level 1

            Yes. Here is my entire code for the file:


            //Attach Video
            var nc:NetConnection = new NetConnection();
            var ns:NetStream = new NetStream(nc);


            //End Attach Video


            //Program Controls
            var muteCount:Number = 1;


            controls.stopButton.onRelease = function(){


            //Mute and Play have AS on them


            var so:Sound = new Sound(bearSound);
            //End Program Controls


            //Programm Scrubber
            var videoInterval = setInterval(videoStatus,100);
            var amountLoaded:Number;
            var duration:Number;
            var scrubInterval;


            I declared 'duration' here because I needed to keep working.


            duration = 12;
            ns["onMetaData"] = function(obj){
                duration = obj.duration;

            function VideoStatus(){
                amountLoaded = ns.bytesLoaded / ns.bytesTotal;
                controls.scrubber.loadbar._width = amountLoaded * 233;
                controls.scrubber.scrub._x = (ns.time / duration) * 223;


            controls.scrubber.scrub.onPress = function(){
                scrubInterval = setInterval(scrubIt,10);


            controls.scrubber.scrub.onRelease = controls.scrubber.scrub.onReleaseOutside = function(){
                videoInterval = setInterval(videoStatus,100);


            function scrubIt(){
                ns.seek(Math.floor((controls.scrubber.scrub._x/223) * duration));
            //End Programm Scrubber


            I'm also having some issues with the 'setInterval' functions I'm using, but I have a different forum set up for that (http://forums.adobe.com/message/1917492#1917492).

            • 3. Re: onMetaData
              kglad Adobe Community Professional & MVP

              duration looks fine.  what makes you think it's not?

              1 person found this helpful
              • 4. Re: onMetaData
                izdo89 Level 1

                Well, the scrubber doesn't seem to be reacting to the total time. It doesn't move at all. I can move it, but it doesn't affect the video.

                • 5. Re: onMetaData
                  izdo89 Level 1

                  Sorry, got everything figured out! Thanks for your help. It was a typo i made in my script. Haha, sorry! Thanks.

                  • 6. Re: onMetaData
                    kglad Adobe Community Professional & MVP

                    you're welcome.