Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jun 18, 2013 Jun 18, 2013

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);

                    }

          }

}

TOPICS
ActionScript
780
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2013 Jun 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 18, 2013 Jun 18, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2013 Jun 18, 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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 18, 2013 Jun 18, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 18, 2013 Jun 18, 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2013 Jun 19, 2013
LATEST

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);

     }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines