Skip navigation
okeeeokeee
Currently Being Moderated

flash cs3 as2 pause video file

Mar 3, 2012 2:40 AM

flash cs3, as2, win xp

 

i want to import a .wmv file in flash. when a play button is pressed, that video file should be played. but i want the video to be paused when (preferrably) the same play button is pressed again.

so:

-how to pause an imported video file?

-how to control both play and pause of the video with the same button?

 

 
Replies
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 3, 2012 6:49 AM   in reply to okeeeokeee

    convert the wmv to flv or f4v using flash media encoder and play the resulting flv/f4v in an flvplayback component.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 3, 2012 9:42 AM   in reply to okeeeokeee

    are you distributing your video along the main timeline?

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 3, 2012 12:32 PM   in reply to okeeeokeee

    attached to keyframe on the same timeline that contains your video, add a movieclip, assign an instance name (eg, btn) and attached to the frame (not the btn), use:

     

    stop();

    var tl:MovieClip=this;

    btn.onRelease=function(){

    if(!btn.toggle){

    tl.play();

    } else {

    tl.stop();

    }

    btn.toggle=!btn.toggle;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 3, 2012 8:42 PM   in reply to okeeeokeee

    Importing a video directly into the main timeline is full of problems!!

    Follow kglad's earlier advice:

    convert the wmv to flv or f4v using flash media encoder and play the resulting flv/f4v in an flvplayback component.

    it will prevent a lot of problems/questions you will have attempting to embed a video into the main timeline.

     

    Adninjastrator

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2012 8:05 AM   in reply to okeeeokeee

    take a screen shot of your main timeline that shows the timeline and the stage and attach the sceenshot here.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2012 9:32 AM   in reply to okeeeokeee

    what's in the movie layer?  is that the layer that contains your video?  if yes, show the on-stage object that's in frame 1 of that layer.

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 4, 2012 10:13 AM   in reply to okeeeokeee

    you're using an flvplayback component.  click it to select it and, in the properties panel, select a skin that has a play/pause button.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2012 7:06 AM   in reply to okeeeokeee

    The FLVPlayback component is by far the easiest... but if you really want to create your own buttons, then I suggest you build a custom NetStream player. This type of player is much more powerful and versatile means of playing video than the Playback component. Keep in mind that it does require a little hand coding... but again...we are firstly advising you to use the Playback component. If you can't use that, then NetStream may be your only other option.

    However, skip the .wmv and go with an .flv or .f4v file. The .wmv compression is not very good and your video file may be too large to download quickly.

    There is a set of very good tutorials that teach you how to build a NetStream player:

    www.gotoandlearn.com

    scroll to the very bottom of the page, there are a set of "Video Basics" tutorials.

    With a NetStream player, you can build controls to pause/stop/start as well as interact with other parts of your Flash.

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/net/NetStream.html

    Best wishes,

    Adninjastrator

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 5, 2012 8:08 AM   in reply to okeeeokeee

    click your component and assign an instance name (in the properties panel, eg, flv_pb).  if you have a movieclip button (eg, btn),  you can use:

     

     

    btn.onRelease=function(){

    if(!this.toggle){

    flv_pb.pause();

    } else {

    flv_pb.play()

    }

    this.toggle=!this.toggle

    }

     
    |
    Mark as:
  • kglad
    72,340 posts
    Jul 21, 2002
    Currently Being Moderated
    Mar 9, 2012 6:31 AM   in reply to okeeeokeee

    you're welocme.

     

    p.s.  please mark helpful/correct responses.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points