6 Replies Latest reply: Sep 14, 2010 2:02 PM by BrianatArena RSS

    Control the timeline of a loaded swf

    BrianatArena Community Member

      I have two swf files. I use as3 on the main timeline of a.swf which successfully loads and inserts b.swf onto the stage (b.swf has a stop on fame 1):

       

      var graphicURL:String = "b.swf";
      var graphicRequest:URLRequest = new URLRequest(graphicURL);
      var graphicSlide:MovieClip;
      var graphicLoader:Loader = new Loader();
      graphicLoader.contentLoaderInfo.addEventListener(Event.COMPLETE , slideLoaded)
      graphicLoader.load(graphicRequest);

      function slideLoaded (event:Event):void
      {
           graphicSlide = MovieClip(graphicLoader.contentLoaderInfo.content);
           graphicLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, slideLoaded);
           addChild(graphicSlide);
      }

       

      myButton, and it's associated click function, also reside on the main timeline of a.swf

       

      myButton.addEventListener(MouseEvent.CLICK, advanceBswf);

      function advanceBswf(event:MouseEvent):void
      {
           graphicSlide.gotoAndPlay(2);
      }

       

      My goal it to get the myButton click to play frame 2 of the recently loaded b.swf - but that's not happening. What am I doing wrong? Thanks for the help. Sorry if I'm asking a redundent question, but can't find a solution anywhere.