4 Replies Latest reply on Mar 25, 2010 8:37 AM by Handycam

    How to access frame labels in a SWF loader?

    Handycam Level 1

      I have a swfloader, which has a swf file embedded.  It loads and plays, and stops at the frame in the swf where I have a stop().

       

       

      In one of my app's functions, I need to send the playhead in the swf to another frame labe, but I seem to have forgotten how to talk to the swf.

       

      <mx:SWFLoader source="@Embed(source='assets/thermal.swf')" id="diagram" />
      

       

      diagram.gotoAndPlay("myLabel"); does not compile.

       

      I know this is simple, but I can't find it anywhere...

        • 1. Re: How to access frame labels in a SWF loader?
          Flex harUI Adobe Employee

          Diagram.content.goToAndPlay

          • 2. Re: How to access frame labels in a SWF loader?
            Handycam Level 1

            No, I tried that.  Give an error:

             

            1061: Call to a possibly undefined method gotoAndPlay through a reference

            with static type flash.display:DisplayObject.

            • 3. Re: How to access frame labels in a SWF loader?
              Shongrunden Adobe Employee

              Does it let you cast Diagram.content to a flash.display.MovieClip then call the method?

              • 4. Re: How to access frame labels in a SWF loader?
                Handycam Level 1

                I tried this:

                 

                                    import flash.display.MovieClip;
                 
                
                          protected function accordion1_changeHandler(event:IndexChangedEvent):void {
                                    var mc:MovieClip = diagram.content as MovieClip;
                                    switch (event.currentTarget.selectedIndex) {
                                         case 0:
                                              currentState = "phase1";
                                              mc.play();
                                              break;
                                         case 1:
                                              currentState = "phase2";
                                              mc.gotoAndPlay("start2");
                                              diagram
                                              break;
                                         case 2:
                                              currentState = "phase3";
                                              break;
                                    }
                               }