2 Replies Latest reply on Jul 17, 2010 5:19 AM by danielnr87

    CuePoints AS2 Not working Properly Netstream

    danielnr87

      Hi All, Im trying to get cuepoints working on an old as2 project.

       

      I have a netstream video component and want the cuepoints embedded in the FLV to trigger buttons to appear. I have embedded them as Event Cuepoints.

       

      For some reason every page on google/forums/websites say a similar thing and suggest using code like this;

       

       

      ns.onCuePoint = function(infoObject:Object){
          trace(infoObject.name);
          if(infoObject.name == "CP1") {
              trace("yes working");
          }
      };

       


      For some reason this doesnt do anything. I have read loads of Adobe  help pages too and the ONLY code I have managed to trace the Cuepoints is as used below;


      ns.onMetaData = function(metaProp:Object) {
          traceMeta(metaProp);
          // traceObject(metaProp, 0);
      };

       


      function traceMeta(metaProp:Object):Void {
          var p:String;
          for (p in metaProp) {
              switch (p) {
              case "cuePoints" :
                  //cycles through the cue points
                  var cuePointArr:Array = metaProp["cuePoints"];
                  for (var j:Number = 0; j < cuePointArr.length; j++) {
                      //cycle through the current cue point parameters
                      trace("\t cuePoints[" + j + "]:");
                      var currentCuePoint:Object = metaProp[p][j];
               
                      trace("\t\t name: " + currentCuePoint.name);
                      trace("\t\t time: " + currentCuePoint.time);
                      trace("\t\t type: " + currentCuePoint.type);
                     
                      if(currentCuePoint.name == "CP1") {
              trace("YO!Loading banner_holder!");
                      }
                  }}}}

       

       

      This shows all of the cuepoints within the FLV. I cant figure out how to change the code to trigger actions WHEN the FLV hits a Cuepoint.

       

      Ive spent months on this and now im pulling hair! Please Help!

       

       

      Cheers

      Dan

        • 1. Re: CuePoints AS2 Not working Properly Netstream
          selangov

          Hi

           

          Below code works fine in cue points trigger when the video is playing.

           

          I have three cue points in my video namely cuepoint1, cuepoint2 and cuepoint3. The following code triggers the alert message "YO!Loading banner_holder!" when the video reaches the cuepoint1. If you would like you can add conditions for any number of cuepoints.

           

          var nc:NetConnection = new NetConnection();

          nc.connect(null);

          var ns:NetStream = new NetStream(nc);

           

          ns.onCuePoint = function(infoObject:Object)

          {

           

           

              trace("onCuePoint:");

              for (var propName:String in infoObject) {

                  if (propName != "parameters")

                  {

                      trace(propName + " = " + infoObject[propName]);

                  }

                  else

                  {

                      trace("parameters =");

                      if (infoObject.parameters != undefined) {

                          for (var paramName:String in infoObject.parameters)

                          {

                              trace("   " + paramName + ": " + infoObject.parameters[paramName]);

                          }

                      }

                      else

                      {

                          trace("undefined");

                      }

                  }       

              }

              trace("---------");  

          if(infoObject.name == "cuepoint1") {

                  trace("YO!Loading banner_holder!");

                          }

          }

           

          ns.play("flv_file_name.flv");

          Thanks

          • 2. Re: CuePoints AS2 Not working Properly Netstream
            danielnr87 Level 1

            Hi Selangov,

             

            Thanks you for replying and tring to help...unfortunately it still doesnt work. It just doesnt seem to recognise the cuepoints!? I have double checked all the code you gave me, and made sure that my netstream was called ns.

             

            Still no luck. What program are you using to add the cuepoints to the FLV? Im wondering if that has anything to do with it.? The only code I have found that 'sees' the cuepoints is in my first post!

             

            Not sure whats going on....?

             

            Cheers for any help