Rollover and gotoAndPlay not working after stop action

  • Thread starter Thread starter fredlexus
  • Start date Start date
Click For Summary
SUMMARY

The forum discussion addresses an issue with rollover buttons in Flash CS4 ActionScript 3 (AS3) where the first three buttons function correctly, but the subsequent four buttons fail to trigger their respective movie plays after a stop action. The code utilizes the Tweener library for animations and includes event listeners for mouse interactions. Despite syntax checks revealing no errors, the buttons do not execute the expected gotoAndPlay commands, indicating a potential problem with the frame references or instance names in the latter buttons' code.

PREREQUISITES
  • Understanding of Flash CS4 and ActionScript 3 (AS3)
  • Familiarity with event listeners in AS3
  • Knowledge of the Tweener library for animations
  • Basic concepts of timeline animations in Flash
NEXT STEPS
  • Debug the ActionScript code for the last four buttons to ensure correct instance names and frame references
  • Learn about the gotoAndPlay function in AS3 and its proper usage
  • Explore the use of the Tweener library for more complex animations and transitions
  • Investigate the implications of stop actions on timeline navigation in Flash
USEFUL FOR

Flash developers, ActionScript programmers, and anyone troubleshooting interactive animations in Flash CS4.

fredlexus
Messages
3
Reaction score
0
Subject: Flash (cs4, as3)
Background:
I have a website with 7 rollover buttons that play a movie. The first 3 buttons display from frames 17-29 (timeline animation plays on frames 1-16). Frame 29 has a stop action as well as blank keyframes. This gives the user the opportunity to select one of the 3 buttons. The same code is repeated on frame 30 for the additional 4 buttons (the instance and frame names are different.
- The objective is to have a movie play and the user sent to a different frame each time a button is selected.

Code:
import caurina.transitions.*;
import caurina.transitions.properties.*;
DisplayShortcuts.init();
conbut.addEventListener(MouseEvent.ROLL_OVER, conbut_ROLLOVER);
function conbut_ROLLOVER(e:MouseEvent):void
{
Tweener.addTween(contact_1, {_frame:10, time:0.2, transition:"linear"});
var over:Over = new Over();
over.play();
}
conbut.addEventListener(MouseEvent.ROLL_OUT, conbut_ROLLOUT);
function conbut_ROLLOUT(e:MouseEvent):void
{
Tweener.addTween(contact_1, {_frame:0, time:0.5, transition:"linear"});
} 

conbut.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_29);
function fl_ClickToGoToAndPlayFromFrame_29(event:MouseEvent ):void
{
gotoAndPlay("contact..");
}

- The code for the remaining 6 buttons is similar except for the instance and frame names. I've attached 2 action script files (pdf format).
The code above works as expected for the first 3 buttons. The issue is with the other 4 buttons. Although the first 3 buttons play their movies and the user is sent to the correct frames which play when the button is selected, this behavior is expected to repeat with the other 4 buttons, but is not. How can this be fixed? I am not getting any errors.
 

Attachments

Last edited by a moderator:
Technology news on Phys.org
Adding additional info to post:

- There is a stop action on the first frame of each movie
- In the code for last 4 buttons I replaced 'gotoAndPlay("home..")' with 'this. gotoAndPlay("home..")'; replaced 'gotoAndPlay("news..")' with 'this. gotoAndPlay("news..")'; replaced 'gotoAndPlay("gallery..")' with ' this.gotoAndPlay("gallery..")'; replaced 'gotoAndPlay("gallery..")' with ' this.gotoAndPlay("gallery..")'; and replaced 'gotoAndPlay("contact..")' with ''this.gotoAndPlay("contact..")'.
Checking the syntax did not produce any errors but, when the buttons are selected the movies do not play and the user is not sent to any frame.
 

Similar threads

Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
1
Views
8K
  • · Replies 8 ·
Replies
8
Views
7K
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
Replies
10
Views
5K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 5 ·
Replies
5
Views
3K