4 Replies Latest reply on Nov 25, 2013 11:22 AM by pajuancho

    Setting closed caption coordinates

    ScottPakis Level 1

      Using this code how do I change the location the text for closed captions. The default is about 10 pixels above the bottom of the stage and I want to make it go all the way down so there isn't a gap. NOTE: The function I created "moveIt" doesn't work. TIA.

       

      import fl.video.*;

      var my_FLVPlybkcap = new FLVPlaybackCaptioning();
      addChild (my_FLVPlybkcap);
      my_FLVPlybkcap.source = "caption.xml";
      my_FLVPlybkcap.showCaptions = false;
      my_FLVPlybkcap.addEventListener(CaptionChangeEvent.CAPTION_CHANGE, moveIt);
      my_FLVPlybkcap.addEventListener(CaptionTargetEvent.CAPTION_TARGET_CREATED, onTarget);

       

      var format:TextFormat = new TextFormat();

       

      function onTarget(e:Event)
      {
          var tf:* = e.target.captionTarget;
          var player:FLVPlayback = e.target.flvPlayback;
          tf = e.target.captionTarget as TextField;//gets hold of the textfield within FLVPlaybackCaptioning component 
          tf.selectable = false; 
          tf.wordWrap = true; 
          tf.multiline = true; 
          tf.defaultTextFormat = format; 
          tf.background = true;   
         
      }

       

      function moveIt(e:CaptionChangeEvent)
      {
          var tf2:* = e.target.captionTarget;
          tf2.y = 500;
      }

        • 1. Re: Setting closed caption coordinates
          ScottPakis Level 1

          Update - I shortened the code to

           

          import fl.video.*;

          var my_FLVPlybkcap = new FLVPlaybackCaptioning();
          addChild (my_FLVPlybkcap);
          my_FLVPlybkcap.source = "caption.xml";
          my_FLVPlybkcap.showCaptions = true;
          my_FLVPlybkcap.addEventListener(CaptionChangeEvent.CAPTION_CHANGE, moveIt);
          my_FLVPlybkcap.autoLayout=false;

           

          function moveIt(e:CaptionChangeEvent)
          {
              var tf2:* = e.target.captionTarget;
              tf2.y = 200;
          }

           

          My movie is 640 x 480 and the close captions appear at y=200 then jump down to the default. Of course I want it to remain in one place just above the controller.

          • 2. Re: Setting closed caption coordinates
            VejOut

            I'm having a similar issue, but only when going full screen. When I'm not changing the Y of the captions it's fine in standard screen mode, but when in full screen it jumps around. REALLY ANNOYING!

             

            If I try to set the Y, I end up with the exact same issue ot the caption text jumping around every time.

             

            Even following this example: http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d1 18a9c65b32-7ee2.html

            and commenting out the Y setting, the captions jump around when going full screen.

             

            HELP!

            • 3. Re: Setting closed caption coordinates
              Craig D. Level 1

              I just started experiencing this same issue, where the captioning is placed about the middle of the video (vertically). I too have tried setting the y coordinate for the captioning. This works when the stage.displayState is "normal" and on rare occasion when the displayState is "fullscreen". This particular video is 320x240 but I have done this many a time with videos at the same dimension without issue.It would be nice if someone would share a solution that works without having to go back to the AS2 FLVPlayback component.

              • 4. Re: Setting closed caption coordinates
                pajuancho Level 1

                Do you guys were able to fix this issue?

                 

                I am using Adobe Media Server 5 with the swf video player called samplemediaplayback.swf and the closed captions moved to the upper left corner when switching to full screen!!