3 Replies Latest reply on May 25, 2007 4:14 PM by Newsgroup_User

    Lingo to allow swf file play and on finish jump to frame?

    rlync04
      Hey all,
      I have imported an swf file into Director. I don't want to stretch the sprite to its whole duration on the score, but I want it to play in it's entirety and when it is finished then jump to e.g.frame 50? Any ideas?

      Thanks in advance,
      Ronan
        • 1. Re: Lingo to allow swf file play and on finish jump to frame?
          Level 7
          You can put a behavior like this on the Flash sprite:

          --------
          property thisSprite
          property totalFrames
          property whereToGo

          on getPropertyDescriptionList
          myPropList = [:]

          myPropList.addProp(#whereToGo,[#format:#integer,#default:"",#comment:"ent
          er the frame number to jump to:"]
          return myPropList
          end

          on beginSprite me
          thisSprite = me.spriteNum
          totalFrames = sprite(thisSprite)._totalframes
          end

          on exitFrame me
          if sprite(thisSprite)._currentframe >= totalFrames then
          go to whereToGo
          end if
          end
          ---------
          • 2. Re: Lingo to allow swf file play and on finish jump to frame?
            rlync04 Level 1
            Hey Rob,
            I tried that code but get error returned with property for totalLength not defined. How do I overcome this?
            • 3. Re: Lingo to allow swf file play and on finish jump to frame?
              Level 7
              It makes a difference which code to use depending on if you use an embedded
              flv into the SWF or an external FLV to the SWF. If it's external, the total
              length will appear as 1 frame.

              I just shipped my first Director piece with all FLV video. It may not be the
              best way, but this is what I did:

              In the flash I have an actionscript to watch for the video to finish:
              <actionscript>

              import mx.video.*;
              function the_end(eventObject:Object):Void {
              //end of video functions
              getURL("event:videoDone");
              }
              myVideo.addEventListener("complete", the_end);

              </actionscript>

              I bring in the FLV so it is linked, not embedded. The embedded verison
              flickered, like you could see the frames. So I tried bring it in, I think
              that's the streaming option. So in the fla, there's 1 frame, 1 with the
              actionscript, and one with the video. Name the video instance "myVideo" to
              match the name in the code. Then of course publish it. Make sure the
              document size, background and frame rate in the SWF are the same as the
              source movie.

              In Director, I imported the SWF, it's externally linked. I found if you make
              a change to the swf and re publish, you have to close the director file and
              re-open it. I have a very simple behavior in Director that goes like this:

              on videoDone me
              go the frame + 1 --this could be whatever you want, go next, call a
              function, etc...
              end

              The videoDone gets called by the getURL line in the Actionscript. So far,
              it's all working great. I'm glad I don't have to put the QT installer on!

              Timm