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

Navigating between keyframes with ActionScript (going back to 1st frame)

Community Expert ,
Oct 09, 2009 Oct 09, 2009

Copy link to clipboard

Copied

Hi,

I'm working on a photography website. I've created event listeners for buttons that allow people to jump between keyframes with images.

I also want to add functionality to go back to the first frame. I've created a button (used a component), gave it an instance name (home_btn) and created code like that:

home_btn.addEventListener(MouseEvent.CLICK, goHome);


function goHome(Event:MouseEvent):void

{

     gotoAndStop(1);

}

It doesn't give me any error message but when I run it and click on the button, nothing happens...

Adobe Community Expert
Adobe Certified Professional
TOPICS
ActionScript

Views

703

Translate

Translate

Report

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
Enthusiast ,
Oct 09, 2009 Oct 09, 2009

Copy link to clipboard

Copied

probably you go to first frame in different timeline. you can got to first frame of main taimeline in this way: MovieClip( this.root ).gotoAndStop( 1 );

Votes

Translate

Translate

Report

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 ,
Oct 09, 2009 Oct 09, 2009

Copy link to clipboard

Copied

Thanks for your answer. It looks a bit more complicated than I thought. Why gotoAndStop(1) wouldn't work?

Adobe Community Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

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
Enthusiast ,
Oct 09, 2009 Oct 09, 2009

Copy link to clipboard

Copied

Each movie clip have  own timeline. Methods for navigation ( like gotoAnd.... ) work for this time line. If you wont to controll different timeline you must address it. I'm not sure what kind of problem you have. It may be that maintimeline have only one frame and you are on it ( in this case gotoAndStop() do nothing  ) and the clip with gallery is no that frame. In this case the solution is to address timeline of that clip.( if clip is named 'mcGallery' than it can be controller like this: mcGallery.gotoAndStop( 1 );

Votes

Translate

Translate

Report

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 ,
Oct 09, 2009 Oct 09, 2009

Copy link to clipboard

Copied

LATEST

I've got everything on one timeline. There are keyframes on frames 10, 20, 30, 40, 50 ,60 with big previews of images and a set of buttons linking to these frames.

I wanted to add another button that would go to frame 1 (there is an introductory text on frame 1 that disappears when you go to other frames with images).

Adobe Community Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

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