How to Insert Variables Into FLVPlayback.Seek

One of the features of a high quality video movie player is its ability to automatically set your video to specific frames. These players let you assign a cue point name to any frame in a video. Once your frames are given cue point names, you can create button menus that let you view the video at the specific cue points defined. Adobe Flash Professional software lets you view videos through its FLVPlayback component. With this program you can easily define specific cue points and then code the buttons needed to search for and access them.

Things You'll Need

  • Adobe Flash Professional
Show More

Instructions

    • 1

      Open the Flash file that contains your FLVPlayback component. In this example, the FLVPlayback component has been assigned the name "VideoPlayerA."

    • 2

      Play your video and decide on the video frame(s) you want to access through your video interface. Use the cue point naming features offered through Flash's integrated development environment to select the video frame and assign a cue point name. For this example, one cue point is selected. It is named "Sun Setting."

    • 3

      Click "Actions" to open up the ActionScript 3 editor to view the FLVPlayBack code. Type into the editor the code to find the exact time (in seconds) that the "Sun Setting" cue point occurs in the video. Attach the "findCuePoint" method to the VideoPlayerA FLVPlayback method to find the time. Specify the cue point name "Sun Setting" as the cue point argument for the "findCuePoint" method. Store the found time in an object named "cuePointSettingSun."

      var cuePointSetingSun:Object = VideoPlayerA.findCuePoint("Sun Seting");

    • 4

      Type into editor, starting on the next line of the ActionScript 3 editor, the code to create a button named "FindSettingSun:"

      FindSettingSun.graphics.lineStyle(4);
      FindSettingSun.graphics.beginFill(0xFF0000);
      FindSettingSun.graphics.drawRect(0, 0 , 50, 20);
      FindSettingSun.graphics.endFill();
      stage.addChild(myButton);

      The code draws a red rectangular button (50 by 20 pixels) at the upper left hand corner of the computer screen.

    • 5

      Type, starting on the next line of the ActionScript 3 editor, the event handler that will respond to a mouse click on the "FindSettingSunButton" button. Use the FLVPlayback component's seek method within the code of the event handler's function to move the video playhead to the time property stored in the cuePointSettingSun object (the time the Setting Sun cue point occurs in the video).

      FindSettingSunButton.addEventListener(MouseEvent.CLICK, seekSetingSun_fn);

      function seekSettingSun_fn(event:MouseEvent):void
      {

      VideoPlayerA.seek(cuePointSetingSun.time); ;
      }

      This event handler code will place the video playhead at the time the "Setting Sun" cue point occurs after the FindSettingSunButton has been clicked.

Learnify Hub © www.0685.com All Rights Reserved