1 Reply Latest reply on May 26, 2009 7:31 PM by nny462

    Stopping an flv using a conditional statement

    nny462

      I have FLV files that continue playing when I leave the frame that they are on. I can stop the playing FLV by putting this code on the following frame:

       

      if (demo.playing) {
          demo.stop();
      }

       

       

      Where .demo is the name of the instance of the .flv component.

       

      Here is the problem - I have many frames with many flvs, and when I tell flash to stop multiple FLVs, for instance:

       

      if (demo.playing) {
          demo.stop();
      }

      if (demo2.playing) {
          demo2.stop();
      }

       

      I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference

       

      As far as I know, flash is telling me that since the instance of "demo2" has not started playing yet (ex. the user only went to the page with the "demo" flv, but not the "demo2" flv yet) that flash has no idea what demo2 is yet. I thought using a conditional statement would remedy this, but I suppose the .swf can't stop playing something it does not yet know exists.

       

      Is there any way I can introduce all of the flv's at the beginning of the file, yet not have them play and not have flash "forget" about them so that I can stop them using the code above? Or is there a way to have the conditional statement not error in the event that the referenced instance has not yet been "introduced"?

       

      I really wish they would have added an "exit frame" command in AS 3.0...

       

      Thanks much for any help, this project is due tonight...  :/

        • 1. Re: Stopping an flv using a conditional statement
          nny462 Level 1

          Also, someone mentioned in a post that they had created a function or code that stopped ALL or ANY flvs from playing when a button was clicked. I was wondering how or if I could do this... The problem is that my buttons are all intoduced and scripted in an external .as 3.0 file, where as my FLVs are all inside the SWF as components (I'm not advanced enough to add the flvs with AS 3.0). Therefore, I don't think I can reference the instance of the FLV in the external .as file, right? So, I'm guessing that might not be an option?