25 Replies Latest reply on Jun 12, 2009 6:27 AM by kglad

    FLV completion not recognized

    David Beedle

      A related issue to a thread that was answered just an hour or two ago. (http://forums.adobe.com/thread/445012?tstart=0)

       

      Here is the situation:

       

      I use attachMovie to load movie clips into "slide_mc"

       

      From the main timeline I want to detect the completion of the FLV that is on the movie clip I've attached to slide_mc. I use this code:

       

      var listener:Object = new Object ();

      listener.complete = function (eventObject:Object):Void  {

           trace ("end of flv");

      };

      this.slide_mc.newMC.clip1_FLVPlybk.addEventListener ("complete",listener);

       

      The trace is not working.

       

      I've tried the same technique that solved my button dilemma (assigning a function after every time I used attachMovie) but no luck.

       

      Thanks for any light you might shed on the subject.

       

      David

        • 1. Re: FLV completion not recognized
          kglad Adobe Community Professional & MVP

          you need to use the path to your listener object.

          • 2. Re: FLV completion not recognized
            David Beedle Level 1

            I'm sorry, I'm not so sure what you mean. (And I'm sure this is my coding ignorance showing.) I thought I was specifying the path. When I trace the FLV I get this:

             

            _level0.slide_mc.newMC.clip1_FLVPlybk

             

            Where would I use the path in my code?

             

            Thanks so much.

            • 3. Re: FLV completion not recognized
              kglad Adobe Community Professional & MVP


              actuall, this.slide_mc.newMC.clip1_FLVPlybk must not be right.

               

               

              is that confirmed when you use:

               

              trace(this.slide_mc.newMC.clip1_FLVPlybk)

              • 4. Re: FLV completion not recognized
                David Beedle Level 1

                trace (clip1_FLVPlybk);  // placed the movie clip that I attach using attachMovie

                //returns _level0.slide_mc.newMC.clip1_FLVPlybk

                 

                trace (this.clip1_FLVPlybk);  // placed the movie clip that I attach using attachMovie

                //returns undefined

                 

                I've tried substituting "_level0" for "this" but still the listener is not called.

                 

                Thanks for your continued help!

                • 5. Re: FLV completion not recognized
                  kglad Adobe Community Professional & MVP

                  what do you see when you use:

                   


                   

                  var listener:Object = new Object ();

                  listener.complete = function (eventObject:Object):Void  {

                       trace ("end of flv");

                  };

                  this.slide_mc.newMC.clip1_FLVPlybk.addEventListener ("complete",listener);

                   

                  trace(this.slide_mc.newMC.clip1_FLVPlybk)
                  • 6. Re: FLV completion not recognized
                    David Beedle Level 1

                    _level0.slide_mc.newMC.clip1_FLVPlybk

                    • 7. Re: FLV completion not recognized
                      kglad Adobe Community Professional & MVP

                      what's the following reveal:

                       


                       

                      var listener:Object = new Object ();

                      listener.complete = function (eventObject:Object):Void  {

                           trace ("end of flv");

                      };

                      this.slide_mc.newMC.clip1_FLVPlybk.addEventListener ("complete",listener);

                       

                      trace(this.slide_mc.newMC.clip1_FLVPlybk.contentPath);
                      • 8. Re: FLV completion not recognized
                        David Beedle Level 1

                        It returns "undefined."

                         

                        A reminder that this FLV is on a movie clip that's "brought to life" like this:

                         

                        On the enterFrame of slide_mc, I fill slide_mc by using:

                             this.attachMovie (_global.myNewCip,"newMC",1);  // _global.myNewCip holds the linkage identifier

                         

                        Throughout my swf, I use attachMovie to swap out new movie clips in slide_mc like this:

                             this.slide_mc.unloadMovie ();  //clear contents of slide_mc

                             slide_mc.attachMovie  (_global.myNewCip,"newMC",1);

                         

                        All the code is called from frame 1

                         

                        I had this same "unrecognized" issue with buttons. Once I put my onRelease code in a custom function, and then called that function after the attachMovie line, my button problem was solved. No such luck with this listener. Or maybe I'm way off base...

                         

                        Thanks very much...

                        • 9. Re: FLV completion not recognized
                          kglad Adobe Community Professional & MVP

                          what do you mean by:

                           


                           

                          On the enterFrame of slide_mc, I fill slide_mc by using:

                               this.attachMovie (_global.myNewCip,"newMC",1);  // _global.myNewCip holds the linkage identifier

                           

                           

                          that code is not repeatedly executing, is it?  ie, if you use:

                           

                               this.attachMovie (_global.myNewCip,"newMC",1);  // _global.myNewCip holds the linkage identifier
                              trace(this.newMC);  // do you see repeated output?

                          • 10. Re: FLV completion not recognized
                            David Beedle Level 1

                            No. That trace returns "undefined"

                             

                            Here's the exact section of code. it is a function called by a button release on the main timeline:

                             

                            function changeSlide (curSlide, newSlide) {//curSlide and newSlide are variables that hold linkage identifiers

                              import mx.transitions.*;

                              import mx.transitions.easing.*;

                              var slideTween:Tween = new Tween (slide_mc, "_alpha", None.easeNone, 100, 0, .35, true); //fadeout slide_mc

                              slideTween.onMotionFinished = function () {// after slide_mc has faded out...

                                  this.slide_mc.unloadMovie ();

                                  slide_mc.attachMovie (String (newSlide),"newMC",1);

                                  updateButtons ();// custom function that contains all onRelease button functions

                                  // do same with Listeners?

                                  new Tween (_level0.slide_mc, "_alpha", None.easeNone, 0, 100, .35, true);

                              };

                            }    

                            • 11. Re: FLV completion not recognized
                              kglad Adobe Community Professional & MVP

                              ok. so, there's no onEnterFrame being used and that was a false alarm.

                               

                              and we're back to:

                               

                               

                              trace(this.slide_mc.newMC.clip1_FLVPlybk.contentPath);

                               

                               

                               

                              now, try:

                               

                               

                              setTimeout(fff,1000);



                              function fff(){

                              trace(this.slide_mc.newMC.clip1_FLVPlybk.contentPath);


                              }

                               

                               

                               

                               

                              or if you know when the contentPath of your component is being assigned, let me know that.

                              • 12. Re: FLV completion not recognized
                                David Beedle Level 1

                                That reveals "undefined" again.

                                 

                                The FLV plays just fine (I'm using the FLV playback component which lives on the movieclip that attachMovie loads). My main timeline can't seem to find it... or something.

                                 

                                Again, I probably know just enough ActionScript to really screw things up big time... and somewhere in my hundreds of lines of code a myriad of mistakes could be lurking...

                                 

                                Thanks,

                                David

                                • 13. Re: FLV completion not recognized
                                  kglad Adobe Community Professional & MVP

                                  when is the contentPath defined?

                                  • 14. Re: FLV completion not recognized
                                    David Beedle Level 1

                                    The content path is defined in the Parameters tab of the selected FLV Playback Component. It is on a movie clip 1 frame in duration.

                                    • 15. Re: FLV completion not recognized
                                      kglad Adobe Community Professional & MVP

                                      something's wrong there.  you should check for two flvplayback instances that exist in the same movieclip and both having the same instance name.

                                       

                                      it doesn't make sense that the flvplayback component would exist (and one of the trace() functions confirms it does exist) and its contentPath not exist (confirmed by a trace() function) when you're setting the contentPath in the parameters panel.

                                      • 16. Re: FLV completion not recognized
                                        David Beedle Level 1

                                        No, there is definitely only one FLV playback component on the movieclip and it has a unique instance name.

                                        • 17. Re: FLV completion not recognized
                                          kglad Adobe Community Professional & MVP

                                          then it's contentPath would be defined as soon as it's defined.

                                           

                                          on the timeline that contains your flv, trace it's contentPath.

                                          • 18. Re: FLV completion not recognized
                                            David Beedle Level 1

                                            I put this code on frame 1 of the timeline that contains the flv:

                                             

                                            trace (clip16_FLVPlybk.contentPath); 

                                             

                                            the result: assets/scene_A_1500kb.flv

                                             

                                            • 19. Re: FLV completion not recognized
                                              kglad Adobe Community Professional & MVP

                                              ok. now we're getting somewhere:

                                               

                                              leave the trace statement that you just added alone.

                                               

                                              on the timeline that contains your listener add the trace statement we used before that had the setTimeout().

                                               

                                              copy and paste the results.

                                              • 20. Re: FLV completion not recognized
                                                David Beedle Level 1

                                                undefined

                                                 

                                                 

                                                Does the the setTimeout() function need to be at any particular point or location on the frame's script?

                                                • 21. Re: FLV completion not recognized
                                                  kglad Adobe Community Professional & MVP

                                                  it needs to be where you put it before (i hope):  adjacent to the listener code.  and why isn't there a 2nd trace output?

                                                  • 22. Re: FLV completion not recognized
                                                    David Beedle Level 1

                                                    Sorry... Correction:

                                                     

                                                     

                                                    the setTimeout() function is called when the swf starts up. It returns:

                                                     

                                                    undefined 

                                                     

                                                    This is because there are a number of rounds of attachMovie which swap out movie clips in and out of slide_mc... and none of them has an FLV. Once I get to the point where I attach the movie clip that's giving me trouble, I get:

                                                     

                                                    assets/scene_A_1500kb.flv //(this is the result of the trace in the movie clip that holds the FLV)

                                                     

                                                    That's it. Here's an excerpt of the section of code so you can see where the setTimeout() function is in relation to the listener:

                                                     

                                                    var listener:Object = new Object ();

                                                    listener.complete = function (eventObject:Object):Void  {

                                                         goForward (); //function that does stuff when I get to end of FLV

                                                    };

                                                    this.slide_mc.newMC.clip16_FLVPlybk.addEventListener ("complete",listener);

                                                     

                                                    setTimeout (fff,1000);

                                                    function fff () {

                                                         trace ( this.slide_mc.newMC.clip16_FLVPlybk.contentPath);

                                                    }

                                                    • 23. Re: FLV completion not recognized
                                                      kglad Adobe Community Professional & MVP

                                                      how is that this.slide_mc.newMC.clip16_FLVPlybk exists and this.slide_mc.newMC.clip16_FLVPlybk.contentPath doesn't exist?

                                                       

                                                      the key to your problem is understanding that answer.  the moment this.slide_mc.newMC.clip16_FLVPlybk exists, it's contentPath should be defined because you're assigning the contentPath in the parameters panel.

                                                       

                                                      so, i don't know what you mean by you're swapping movieclips in and out of slide_mc and none have an flv but, this.slide_mc.newMC.clip16_FLVPlybk still exists when that listener code is created.  then when you get to a movieclip that has an flv you're probably creating a new this.slide_mc.newMC.clip16_FLVPlybk instance.

                                                      • 24. Re: FLV completion not recognized
                                                        David Beedle Level 1

                                                        Success!

                                                         

                                                        Thank you so much for taking me through this. After a good nights sleep I started fresh... trying to absorb the logic of your final post... and I saw it. And more importantly, I understand it. I needed to pinpoint the moment that  this.slide_mc.newMC.clip16_FLVPlybk exists, and then I followed and cleaned up the "rat's nest" of my code and there it was. I was calling my listener at a point when  this.slide_mc.newMC.clip16_FLVPlybk did not exist.

                                                         

                                                        Again, thank you for your patience.

                                                        • 25. Re: FLV completion not recognized
                                                          kglad Adobe Community Professional & MVP

                                                          you're welcome.