6 Replies Latest reply on Feb 16, 2007 1:02 PM by liquidleaf

    How do I make a movie wait for a FLV cuepoint

    bobmcinnis Level 1
      I'm trying to synch a "talking head" FLV with some graphics, so I simply want to get my movie to wait for a cuepoint to begin playing again. I'm making it Flash 7 compatible, so I'm using the older Media Display component.

      Is there a "stop" and "wait for cuepoint" that would work? If someone could give me the actionscript I should paste in the frame, it would be greatly appreciated, since I don't really know actionscript that well. Thanks.
        • 1. Re: How do I make a movie wait for a FLV cuepoint
          bobmcinnis Level 1
          OK, it looks like I need a behavior, but does anyone know which one? Thanks
          • 2. Re: How do I make a movie wait for a FLV cuepoint
            bobmcinnis Level 1
            Am I asking the wrong question here? I'd just like to pause at a certain frame and then have the FLV start it back up again with a cuepoint trigger. I can't imagine this would be very hard for anyone who knows actionscript.

            I'd really appreciate any help anyone's willing to offer. Thanks.
            • 3. Re: How do I make a movie wait for a FLV cuepoint
              Rothrock Level 5
              I'm sensing that you don't know much actionscript. If you want to do much that is really fun and cool you will need to learn some.

              Start with the help files. Everytime you use a new component or class go to the Actionscript Language Reference or the Component Dictionary. Don't try searching it will generally only confuse you more.

              This next bit is going to sound silly, but the differences are subtle and please take it in the manner it is offered.

              When you say you'd like to pause at a certain frame you mean a movieclip that you have, right?

              If you check all the information about the FLVs and the Media component you will find there is absolutely nothing that allows it to make a movieclip pause or play. But if you check the MovieClip class you will find there are the MovieClip.stop() and the MovieClip.play() methods. These are the only ways to get a movieclip to pause/stop and or play. There are no others.

              So you have most of the answer there in your second post. It is just worded a bit off.

              You need a movie to pause (for which you will use the MovieClip.stop() method) and when a cuepoint happens you will need to start the movie using MovieClip.play();

              If you check the MediaDisplay component directory there will be sample code for how to listen for a cuepoint. I'm still using Flash 7 so my help files are organized a bit differently, but what you are looking for is under Media.cuePoint.

              Notice the code at the bottom of the entry – READ the whole entry, even if you don't understand it all now, read it, outloud if it helps. You will need to have an instance of the playback component on the stage (in this example it is called myPlayback, but you could call it whatever you wanted, just make sure that both names are the same.

              I recommend trying this outside of your current project. Set up a simple new document, put an instance of the playback component on the stage, give it an instance name, assign an FLV to it, give it a cuepoint or two, and then add the listener code, just as it is. See how it works? Do you get the trace statements?

              Then you can develop it a little further. Add some named movieclip to your stage. Add a line myClip.stop(); Also notice that you can give your cuepoints names? Put a few in and call some start and some stop (or whatever you want.) Then instead of a trace in the cuepoint listener have something that says, "If the cuepoint is called start I should tell the movieclip to play and if the cuepoint is called stop I should tell the movieclip to stop/pause."

              I could easily write all this code out for you, but what would be the fun of that for you? Give it your best shot and post back as you accomplish things.
              • 4. Re: How do I make a movie wait for a FLV cuepoint
                bobmcinnis Level 1

                Thanks so much for the advice. With FLV's being called movies and published Flash documents called movies, I'm not sure if I'm using the right terminology or not, so before I get to work on the advice above, I just want to double-check that I'm properly communicating what I'm trying to do.

                I've got a FLV file that is playing continuously and within it are cuepoints. I'm actually adapting a template on Adobe's web site that has a presenter on one side and graphics fading in and out on the other. I want the FLV to control when the graphics fade in and out using a pause and wait for cuepoint command triggered by cuepoints within the FLV. The template uses screens, but I'd like the timeline within some of the screens to stop and then resume again using cuepoints as well.

                In Director, I use this and the playhead just waits for a certain cuepoint. A real simple command that I can't seem to translate to Flash. Is this the problem you thought I had? I hop this helps clarify it. I'm really looking for the code to put in to the frame where I want it to stop and wait for a cuepoint. Is it as easy as that?

                Thanks again
                • 5. Re: How do I make a movie wait for a FLV cuepoint
                  Rothrock Level 5
                  Oh, with screens you are completely out of my league. So I have no idea how to help you with that. I can only help you with the FLV, cuepoints, and movieclips.

                  I try to call the video either video or FLV. Movie or movieclip will refer to instances of the movieclip class or the overall swf movie (which is also an instance of the movieclip class.)

                  If you are using the Flash 7 video, there are no cuepoints in the FLV. The cuepoints are actually part of the Media Component and are (if the documentation is to be believed) just an array. It should relate to your FLV, but it doesn't have to. For example you can put a cuepoint at 16 minutes even if the FLV is only 30 seconds long.

                  If you check the movieclip class there is no pause-and-wait or other type of pause method. Can you explain the difference between stop-now-and-go-when-told and what you are asking for? To my mind they are the same thin. I really think you should do what I suggested. This will help you understand what is goin on – at least without the screens. That will probably change everything. So here it is:

                  Make a new document.

                  Put an instance of the media component on the stage. Give it a name.

                  Put an instance of some movieclip on the stage. Give it a name.

                  Use the Media.setMedia() method to attach an external FLV.

                  Use the Media.addCuePoint() method to add a cuepoint.

                  Use the code sample from the Media.cuepoint event to listen for cuepoints. First just try it as it is with the trace statements.

                  Replace the code in the event listener (from the previous step) with code that tells your movieclip what to do.
                  • 6. Re: How do I make a movie wait for a FLV cuepoint
                    Here's a little quick snippet I found on another forum.

                    The following example requires Flash 8 or MX, and assumes that you have a FLVPlayback or MediaPlayback component in the main timeline and has an instance name "player".


                    //cuePoint handler
                    function onCuePoint(cp: Object)
                    //to retrieve cue point name
                    //to retrieve cue point time
                    //to retrieve cue point type
                    //to retrieve cue point parameters count
                    //to reference paramter, param_name is the paramter name you specified when making the flv

                    //attach onCuePoint function to cuePoint event
                    player.addEventListener("cuePoint", onCuePoint);

                    -- This doesn't really tell you how to wait for a cuepoint, but the eventlistener should give you some guidance. The onCuePoint handler will get called whenever the FLV passes a cuepoint. Inside the handler, you can decide what to do depending on what cuepoint has passed.

                    Here's another bit of documentation from Macromedia:
                    http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveD ocs_Parts&file=00003484.html

                    Confusing? Yes. But if you are familiar with Lingo, Actionscript shouldn't be too difficult to figure out, even though it is a different animal.

                    I hope this helps, I'll try to whip up an example soon.