8 Replies Latest reply on Jul 19, 2007 4:36 AM by rallen2006

    CuePoints Opening a SWF

    rallen2006
      Hello, me again!

      I have a flash movie thats has an flv with a cuepoint in it called 'End', I created the cuepoint when you import videos.

      When the video reaches 'end' i want it to open an external swf file whihc is in the same directory.

      Any ideas?

      Where do i put the actionscript?

      I thought it might be along the lines of opening a movie like this:

      on (click) {
      this._parent.test_vid.play()
      loadmovie("excel_flash.swf",this._parent.excel_holder_mc);
      }

      But then realised i might need a function in there or something...i hate programming!

      :( please help
        • 1. Re: CuePoints Opening a SWF
          CodeManNew
          rallen,

          The last post in this livedocs appears to be very close to what you're looking for:

          http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveD ocs_Parts&file=00003488.html
          • 2. Re: CuePoints Opening a SWF
            rallen2006 Level 1
            i still cant get this to work.

            I am so bad at programming!

            I have this code using the example on the live docs on the actions of the video:


            //leave this as is
            var listenerObject:Object = new Object();
            listenerObject.cuePoint = function(eventObject:Object):Void {

            //change this info..."end" is the name that you called your cuepoint when
            you embedded it into the video
            if(eventObject.info.name == "end"){

            //tell your movie what you want it to do once your cuepoint has been hit
            loadmovie("excel_sample_two.swf",this._parent.line_holder_mc);
            }

            //test_vid is the name of video on the stage//

            test_vid.addEventListener("cuePoint", listenerObject);

            I get this error when i run it:




            **Error** Scene=Scene 1, layer=actions, frame=1:Line 36: Syntax error.
            test_vid.addEventListener("cuePoint", listenerObject);

            **Error** Scene=Scene 1, layer=actions, frame=1:Line 25: Statement must appear within on/onClipEvent handler
            listenerObject.cuePoint = function(eventObject:Object):Void {

            Total ActionScript Errors: 5 Reported Errors: 5


            Please help :(
            • 3. Re: CuePoints Opening a SWF
              CodeManNew Level 1
              ActionScript 2 or 3?

              I will look at this in more detail soon.
              • 4. Re: CuePoints Opening a SWF
                rallen2006 Level 1
                I am using Flash 8 Professional and Acrtionscript 2 i think
                • 5. Re: CuePoints Opening a SWF
                  CodeManNew Level 1
                  ok, that clarifies that
                  • 6. Re: CuePoints Opening a SWF
                    rallen2006 Level 1
                    sorry i am having one of those weeks in flash!

                    Allh help really appreciated :)
                    • 7. Re: CuePoints Opening a SWF
                      CodeManNew Level 1
                      rallen,

                      Here is the basic code you need:

                      stop();

                      var listenerObject:Object = new Object();
                      listenerObject.cuePoint = function(eventObject:Object):Void {
                      trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
                      trace("Cue point name is: " + eventObject.info.name);
                      trace("Cue point type is: " + eventObject.info.type);

                      // put in an if statement to test for the End cuepoint

                      if (eventObject.info.name=="End"){
                      //load external swf
                      trace ("End Cuepoint Actions triggered!");

                      }



                      }
                      my_FLVPlybk.addEventListener("cuePoint", listenerObject);

                      //--------

                      putting your actions to load the external swf in between the if statement brackets... the action could be going to another frame where the .swf will load.


                      I used this code to create this example

                      Which shows how the cuePoints are detected and read.

                      I also created this final example that shows the external .swf being loaded as soon as the End cuePoint hits. You'll see it's so instant that you don't even see the End cuePoint get reported on screen.

                      The frame 2 code is simply:

                      stop();
                      // load the external .swf
                      loadMovie("external.swf",holder);

                      Where a movie clip symbol of the same size as your external .swf has an instance name (in properties) of holder.

                      You can download all the source files in one .zip here

                      That should help you out.
                      • 8. Re: CuePoints Opening a SWF
                        rallen2006 Level 1
                        thank you , you're a star, will look at this after lunch and post back.

                        Thank you so much for your help and time wiht this :)