Skip to main content
Participant
June 18, 2013
Question

How can I have keyframes on one layer proceed while using the gotoAndStop function?

  • June 18, 2013
  • 3 replies
  • 858 views

I have a Flash presentation that allows me to pair videos with the slides using a nice piece of ActionScript. The presentation advances to the slide on the next keyfram when the viweer clicks the "next button" and the video for that keyframe (on a separate layer) begins playing.

owever, I am now trying to pair two slides with the same video without having the video restart or requiring the viewer to click the"next slide button" I was hoping I could just turn the two slides into a video clip, convert it into a symbol and insert the symbol in place of the static slide, but nothing seems to happen. I'm wondering if the "gotoAndStop" function in the ActionScript is preventing it from playing.

Any thoughts on how I can have the presentation be controlled by the next and previous buttons most of the time, but have the exception of one slide that changes on its own? The relevant (I believe) code is below.

Thanks!

Julien

// FUNCTIONS AND LOGIC

function fl_prevSlide():void

{

          if(slides_mc.currentFrame > 1)

          {

                    slides_mc.gotoAndStop(slides_mc.currentFrame-1);

                    if(transitionOn == true)

                    {

                              fl_doTransition();

                    }

                    if(pageNumberOn == false)

                    {

                              slideNumber_txt.text = "";

                    } else {

                              slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);

                    }

          }

}

function fl_nextSlide():void

{

          if(slides_mc.currentFrame < slides_mc.totalFrames)

          {

                    slides_mc.gotoAndStop(slides_mc.currentFrame+1);

                    if(transitionOn == true)

                    {

                              fl_doTransition();

                    }

                    if(pageNumberOn == false)

                    {

                              slideNumber_txt.text = "";

                    } else {

                              slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);

                    }

          }

}

This topic has been closed for replies.

3 replies

Grandpa3D
Inspiring
June 19, 2013

Try this code. Replace FLVmovie with the instance name of your FLV & set the time to when the frames shoudshould advance.

import flash.events.Event;

this.addEventListener(Event.ENTER_FRAME, checkTime);

function checkTime(e:Event):void {

      if (this.FLVmovie.playheadTime >= 15)  // This is the playhead time in seconds

      {      

          this.gotoAndStop("frame label or frame #");

          this.removeEventListener(Event.ENTER_FRAME, checkTime);

     }

}

Grandpa3D
Inspiring
June 18, 2013

Is there is metadata available in the video? If so you can use that to control advancement of the slides.

Participant
June 19, 2013

No, there is no metadata at the moment. I could add it if need be--is there a simpler solution? If not, how would I use metadata to trigger the advance?

Thanks for the response!

kglad
Community Expert
Community Expert
June 18, 2013

what do you want to trigger one frame to move to another?  the end of a video?  if so, is the video playing in an flvplayback component?

Participant
June 19, 2013

Thanks for the quick response!

Yes, the video is in a flvplayback component, but I want the slide to advance partway through the video. I was hoping that the slide advance would be triggered after a certain amount of time. Is that feasible?

kglad
Community Expert
Community Expert
June 19, 2013

yes, you can use (among other things) a timer:

var t:Timer=new Timer(10000,1);  //10000 ms = 10 seconds

t.addEventListener(TimerEvent.TIMER,f);

t.start();

function f(e:TimerEvent):void{

gotoAndStop(whatever);

}