16 Replies Latest reply on Sep 21, 2006 7:55 AM by derobinson

    Stop Script in Movie

      I am simply trying to figure out how to stop a .swf movie at a desired position. The movie plays fine (Movie Link) .swf and .flv on the server. I apologize for the newbie question ... I purchase a Falsh 8 text book and countless internet searches but I still cannot figure out how to place in the stop script as a desired location. Any help would be appreciated.
        • 1. Re: Stop Script in Movie
          derobinson Level 1
          Not really sure what you'r trying to stop...the video? There doesn't seem to be any animation elswhere to stop. Am I missing something?

          To stop a SWF timeline, simply put


          in a keyframe where you'd like to stop it. To stop the video, you'd need some logic in the code to know when to stop it, then just address the display component and tell it to stop:


          If I missed your question, write back and we'll see if we can't work it out! Good luck!
          • 2. Re: Stop Script in Movie
            jwdawg77 Level 1
            Thank you for your reply derobinsion. I am trying to stop the movie at the end where the the picture of the Chef comes in so that it stops before fading to black. Thank you for the code. I have read up on the stop script. What I am unsure of is ... When I import the video into Flash, it creates a .swf and a .flv file. That is what I loaded onto the server together and it plays as you see. In the Flash interface, I only see 1 Keyframe. See Graphic: Web Link
            I created another layer and called it actions. I think I understand what you are saying above, I work with Adobe After Effects and are familiar with Keyframes, Timelines, etc ... I just do not know how to get there. i.e. the swf. timeline? I appreciate your help and Thank You for bearing with this "newbie". I look foward to pursuing some interface training soon.
            • 3. Re: Stop Script in Movie
              derobinson Level 1
              Really, the easiest thing to do might be to edit your video, cut the fade and end it on the frame you want to stop on...especially since you're already familiar with AE.

              Otherwise, it looks like you're using the FLVPlayback component. You can specify cue points for the FLV and do something (like stop the video) when that point is reached during playback. Here's the LiveDocs link to working with cue points:


              Hope that helps!
              • 4. Re: Stop Script in Movie
                jwdawg77 Level 1
                Hi David,

                That is what I thought too. Just edit my Video in my NLE so that it ends without a Fade. It seems when I encode the video into Flash to prepare for the web, it fades it when it plays back in Flash and on progressive download from the web server. I initially researched and tried the Cue Point Event feature. But I am unsuccesful. (I think my code is wrong) I provided more graphics on the web LINK What am I missing? I provided a screen shot of the cue point I embedded when encoded and a screen shot of the Component Inspector in Flash. Thanks again for your help and your resources. - jw
                • 5. Re: Stop Script in Movie
                  jwdawg77 Level 1
                  I also have tried to use Behaviors and have followed the documentation. Graphic Link
                  I do not understand how to specify the location on the timeline of the .swf or .flv? As the previous post ... I have cue point embedded, but do I need to label the stop script? I does not trigger on playback? If you can see something I have done wrong or not included ... any tips would be appreciated on the Cue Point or the Behavior Process.
                  • 6. Re: Stop Script in Movie
                    derobinson Level 1
                    I think you've got several things going on. The LiveDoc link I sent you had a couple of different ways of doing this, but you only need to choose one. Since you've already embedded the cuepoint when encoding the FLV, you've already started down the road of one of those methods. You should only have to write an event ilstener for your FLV playback component that will listen for your cuepoint like this:

                    var listenerObject:Object = new Object();
                    listenerObject.cuePoint = function(eventObject:Object) {
                    //since you only have one cuepoint, you shouldn't even have to check for its name, just stop the video when it fires

                    I think the Behaviors panel would be used more for a button that the user could use, not in your case. Also, I'm not really aware of any edfault fade-out when encoding FLVs so you might want to take a look back at that as well if th ecode still gives you headaches...and it gives us all headaches at one time or another...

                    Let me know how it goes!

                    • 7. Re: Stop Script in Movie
                      jwdawg77 Level 1
                      Hi David,

                      Thank you again for your help and code provided. I figured out the probelm with the video fading. In my video editor, I was fading in the begining so when the movie was over it would resort back to the start of the movie which was black. I would still like to attempt to do this correctly. I do not understand WHERE to place the code for the event listener. I provided the graphic, Web Link, what I see in the component inspector, but the cue points are not editable. Is the code added under Bindings or Schema and does it get linked to the particular cue point? And per your instructions, that should not matter since I only have one cue point.

                      I tried to follow this from the live doc, (Below) drag the FLVplayback component to the stage ... and being such a "noob" , sorry, I cound not get the name in the Instance Name Box (could not get to the Instance Name?) ... sorry. Is this the right procedure before I try again? ... substituting the code you gave me.

                      To create and use cue points with the FLVPlayback component:
                      Create a new Flash document called cueFlvPb.fla.
                      Drag an instance of the FLVPlayback component from the Components panel (Window > Components) to the Stage.
                      The component is in the FLVPlayback - Player 8 folder.

                      Select the component and open the Property inspector (Window > Properties > Properties).
                      Type my_flvPb in the Instance Name text box.
                      Drag an instance of the TextArea component from the Components panel to the Stage.
                      Select the TextArea component and type my_ta in the Instance Name text box.
                      With the TextArea component still selected, type 200 in the width text box and 100 in the height text box.
                      Select Frame 1 on the Timeline, and type the following code in the Actions panel:

                      I appreciate your time, patience and help. I get lost, then I try different routes and I though this time I would stop make sure I am in the right area before I continue.

                      • 8. Re: Stop Script in Movie
                        derobinson Level 1

                        OK, first you don't absolutely need the text box. They use it in the example just to show you that the code is working.

                        -drag the playback component to teh screen as you describe. Give it an instance name in the PI..."my_flvPb" is fine...in the code I posted I called it "myFLV"...it doesn't matter as long as the instance name you give the component in th ePI is the name you use in your AS. Configure the component to point to your FLV, etc.
                        -add a new layer to your timeline. By convention, this is th etop layer in your timeline and most people give the layer a name like "AS", "actions", or something like that. Select the keyframe in that layer (the same keyframe where you video component sits one layer down), then open the Actioscript panel (F9 is th ekeyboard shortcut). This is where you place the code for the event listener. You should also add this at the bottom of it all to prevent your timeline from looping:


                        Make sure that the instance name in the code matches the instance name you gave the component and test.

                        Hopefully, that will all work. I don't think it should even matter what kind of cue point it is since there's only one, you're just listening for the cue point to fire, not what the cue point is.

                        Let me know how it works out!
                        • 9. Re: Stop Script in Movie
                          jwdawg77 Level 1
                          Hi David,

                          I owe it to both of us to see this through! I have all the email's printed out etc ... Sorry for another "noob" question, but before I can apply the new layer, action script ... I am stuck on getting the "Instance Name" created for the FLVplayback. I can successfuly drag the FLVplayback on stage. How do I give it an "Instance Name" name??? I tried <right click> on the box (pc version), looking on the menus, <help content> with no luck.
                          I have enrolled in a Online Training Course to learn the interface from the ground up. My primary focus will be encoded video and I need to learn how to work with multiple interactive videos. I really appreciate your help, time and effort on this project.

                          Thank you,

                          - jw
                          • 10. Re: Stop Script in Movie
                            derobinson Level 1
                            Make sure you have the playback component selected on the stage. Then make sure that your Property Inspector is open (Window>Properties>Properties ... by default it is at the bottom of your workspace). If its already open, make sure you have the Properties tab clicked and look in the far left of the panel. There's an input box with the greyed out words "<Instance Name>". Simply put your cursor in that box and type the Instance Name of your choice (make sure it matches what you've used in the code).

                            That's it!

                            Good luck!
                            • 11. Re: Stop Script in Movie
                              jwdawg77 Level 1
                              Hi David,

                              Thanks for the tip ... Right before my eyes! Can't believe I missed that ...
                              Added the instance name (myFLV) (the parameterds in the Componet Inspector dissapear ?)

                              I created another layer and call it ActionScript ... If I select Layer 1, I cannot find the Instance Name again ... I can click on the Component that a dragged over, but only when Layer 2: "Action Script: is Highlighted do I have an option of the Instance Name under properties. I added the code to Actions when the ActionScript Layer is highlighted, the movie plays but it does not stop.

                              Here is a link to screenshots: Updated Screenshots

                              Stuck -jw Whew!
                              • 12. Re: Stop Script in Movie
                                derobinson Level 1
                                Good Monday to you JW--

                                The Properties Inspector is context sensitive, so depending on what you have selected, you will see different options, but that doesn't mean you've lost anything. Once you've added the FLV component instance name and clicked on the AS layer, the PI is just giving you the option for the frame. If you click on the component again, you should see the instance name you typed in (N.B. sometimes you need to hit the enter key after typing in the instance name to confirm its assignment).

                                Confirm that the instance name is assigned and that its the same that you use in the AS. If it still doesn't work, maybe you could post the FLA and FLV somewhere for me to take a look at?
                                • 13. Re: Stop Script in Movie
                                  jwdawg77 Level 1
                                  Hi David,

                                  I tried again with no luck.
                                  Same link to download project files. Web Link - Project Files
                                  Look forward to see what I am missing?

                                  Thanks Again, Have a great weekend

                                  - jw
                                  • 14. Re: Stop Script in Movie
                                    derobinson Level 1
                                    hey JW!

                                    Sorry its been a while...took a week-long vacation and just got back last night!

                                    Well, I started out by trying to add a new cue point using AS, testing, testing, etc, etc...still jumped to black...finally looked at the Paramters tab of the Properties Inspector (while having the FLV playback component selected). Scroll through the options and set the autoRewind property to FALSE and that should do the trick!

                                    It's always the simplest things...ok, well, not ALWAYS...

                                    Give that a try and let me know!
                                    • 15. Re: Stop Script in Movie
                                      jwdawg77 Level 1
                                      Sorry for the Delay David ...
                                      I have been out of town. I changed the <Auto Rewind> to false in the Properties Inspector and it worked like a charm!
                                      I appreciate all your help and patience. I learned allot of things along the road.
                                      Thanks again.
                                      • 16. Re: Stop Script in Movie
                                        derobinson Level 1
                                        Glad to hear it worked!