3 Replies Latest reply on Feb 17, 2008 7:20 AM by peterent

    Cannot control Embedded MovieClip

    Venkat_G
      Consider the following code:

      package
      {
      import flash.display.MovieClip;
      import flash.display.Sprite;
      import flash.display.FrameLabel;
      import flash.display.Scene;

      public class EmbedTest extends Sprite
      {
      [Embed(source="Test.swf")]
      private var myRes:Class;

      public function EmbedTest()
      {
      super();
      var mc:MovieClip = new myRes() as MovieClip;
      addChild(mc);

      var labels:Array = mc.currentLabels;
      trace("Movie: " + mc);
      trace("Movie: " + (mc is MovieClip));
      trace("Total frames: " + mc.totalFrames);
      trace("Labels:");
      for (var i:uint = 0; i < labels.length; i++)
      {
      var label:FrameLabel = labels ;
      trace("frame " + label.frame + ": " + label.name);
      }

      trace("Scenes:");
      for (i = 0; i < mc.scenes.length; i++)
      {
      var scene:Scene = mc.scenes
      ;
      trace("scene " + scene.name + ": " + scene.numFrames + " frames");
      }
      }
      }
      }

      Test.swf is a movie clip with 50 frames. And 3 labels.

      Yet, the output from the above code says the movie clip has 0 frames and no labels. gotoAndPlay() does nothing. However, the movieclip itself shows up and plays just fine.

      Can the embedded movie clip not be controlled? How do I get it to display the correct number of frames in the trace output?

      Venkat