8 Replies Latest reply on Apr 8, 2008 10:30 PM by dave_jack

    video help

      I have a project in which I want to have a single flash video window on stage that can play multiple videos on demand. Right now I have buttons (graphics with embedded code) on stage with onRelease code which will call the various videos into visibilty. So far I have only been able to do this by having all the videos on stage, sitting on top of each other and letting the Actionscript code in the buttons control the visibility of all of the video windows, but surely there is a cleaner, easier way to accomplish this. I have seen that when you import multiple videos, such as I have, Flash only adds one library item (FLVPlayback) and the different videos are addressed via the instance names and/or the parameters. Can someone advise me on how to accomplish having one video instance on stage that can play different videos on demand. I would greatly appreciate it if you can, and please keep it simple as I am not a power coder by any means.
        • 1. Re: video help
          kglad Adobe Community Professional & MVP
          use the contentPath of your flvplayback instance to control the video played.
          • 2. Re: video help
            dave_jack Level 1
            When I place an instance of FLVPlayback on stage, it comes in without an instance name and without the contentPath name. I understand how to put in the contentPath name (it needs the file name generated automatically by Flash when I imported the video into the file) but I don't know the proper syntax of the code of how to address it from the button. Can you give me an example of how to write the code. I'm guessing something on the order of "onRelease, go to this contentPath name". Right now I have been addressing the visibility of it using the instance name that I gave it. Thanks...
            • 3. Re: video help
              kglad Adobe Community Professional & MVP
              why are you importing video "into the file"? you should just have your flvplayback instance onstage and it should be assigned an instance name in the properties panel. that's it.

              then you can assign the contentPath property of you flvplayback instance in your various buttons.
              • 4. Re: video help
                dave_jack Level 1
                I used the "import video" sequence under FILE>IMPORT menu to convert my mpg file into a FLV format. What I don't understand/know is the proper Actionscript 2.0 syntax to tell the onRelease code how to assign the contentPath property. The help files have been telling me to do something like this, whereby the instance name is assigned the name "my_FLVPlybk". Is this close? Another thing I don't know how to do is to give it a relative path to where the video file lives. Since I'm inside the button movie clip with this code I know I have to back out to the main scene, but "_root" doesn't seem to do it and "_parent" or "_parent._parent" doesn't seem to do it either. I assume it has to be a relative path in order to function correctly on the web. Again... not a power user here. Just know enough to be dangerous.

                import mx.video.*;
                my_FLVPlybk.autoPlay = false;
                var listenerObject:Object = new Object();
                listenerObject.ready = function(eventObject:Object):Void {
                my_FLVPlybk.addEventListener("ready", listenerObject);
                my_FLVPlybk.contentPath = "_parent._parent.bk3_ani02.flv";
                • 5. Re: video help
                  kglad Adobe Community Professional & MVP
                  your flv should be an external file:

                  • 6. Re: video help
                    dave_jack Level 1
                    I really appreciate all your help but nothing seems to be working. This is the onRelease code I've been using in other areas to pull in graphics, but modified here to fit what you gave me. All I'm getting is the controls skin with a rolling progress bar and when I click on the "play" button it gives me an output error telling me it can't find the video. The code at the top produces an alpha effect on the buttons when the cursor rolls over it. The commented out setProperty code below your code is what is currently working on 6 instances of the FLVPlayback symbol, all on top of each other... visiblity being controlled.

                    I did try the exact code you gave me and it gave me some kind of ClipEvent error.

                    I tried adding an "_root." in front of your modified code to make it more like my setProperty code but that didn't work either.

                    on (rollOver){
                    this.onEnterFrame = function(){
                    this._alpha -= 8;
                    if (this._alpha < 50){
                    this._alpha = 50;
                    } //end if to stop alpha fade
                    } //end onEnterFrame
                    }//end rollOver

                    on (rollOut){
                    delete this.onEnterFrame;
                    this._alpha = 100;

                    on (release){
                    my_FLVPlybk.contentPath = "bk3_ani02.flv";

                    /*setProperty(_root.rotatePlane, _visible, true);
                    setProperty(_root.landGear, _visible, false);
                    setProperty(_root.axises, _visible, false);
                    setProperty(_root.landGear2, _visible, false);
                    setProperty(_root.sat, _visible, false);*/

                    • 7. Re: video help
                      kglad Adobe Community Professional & MVP
                      then your flv file is NOT in the same directory as the html file that embeds your _level0 swf.
                      • 8. Re: video help
                        dave_jack Level 1
                        I'm not really sure about what you mean by "_level0 swf." but my FLV files are in the root directory of the main folder that holds the html file and swf file that is generated by publishing the FLA file. Is that what you mean?

                        I did have partial success just now with this code...

                        on (release){
                        this.onEnterFrame = function(){
                        _root.my_FLVPlybk.contentPath = "bk3_ani01.flv";

                        The problem is thou it sits there on stage as only the control skin with the rolling progress bar until I click on the play button, then it will load and play. And it does change (again with the rolling progress bar) when I click on another button with the same appropriate code calling a different file. So... is there a way to make it preload and be ready to play without having to load when the button is clicked?

                        Again... appreciate all your help. This was pretty major progress.