1 Reply Latest reply on Jun 10, 2007 2:11 PM by Alexandre Madurell

    Inaccessable component properties

    WellingtonSouza
      1- I create a new movie clip symbol and called it m1.
      2 - I add an flv playback to the movie clip and give it an instance name (pl1).
      3 - I dynamically add an instance of the movie clip to the stage:

      this.attachMovie("m1","m1",1);

      4 - Try to make the flv player play a movie:

      this.m1.pl1.contentPath="sample.flv";
      this.m1.pl1.play();

      This does not work! Actually if i try to print the other properties of the player, I will get an error message.

      trace(this.m1.pl1); - gives - _level0.m1.pl1

      However, trace(this.m1.pl1.autoPlay); - gives - undefined

      Why can I not access this object?
        • 1. Re: Inaccessable component properties
          Alexandre Madurell
          Hi Wellington

          I'd go with something like:

          // Import class
          import mx.video.FLVPlayback;
          // Make it easier to call the object with a variable
          var film_flvp:FLVPlayback = this.m1.pl1;
          // Create a listener object for the movie
          var filmListener:Object = new Object();
          // What to do when the movie is ready
          filmListener.ready = function():Void
          {
          film_flvp.seekSeconds(0);
          film_flvp.play();
          }
          // Tell the listener object to listen to the FLV playback "ready" event
          film_flvp.addEventListener("ready", filmListener);
          // Start loading the external video
          film_flvp.contentPath = "sample.flv";

          Now, don't forget to select the Export for ActionScript option in the Linkage properties of the m1 clip symbol in the library. Otherwise, you won't be able to use the attachMovie method to add it to the stage.

          Boa sorte aí ;)