Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rollover and gotoAndPlay not working after stop action

  1. Sep 11, 2011 #1
    Subject: Flash (cs4, as3)
    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 (Text):

    import caurina.transitions.*;
    import caurina.transitions.properties.*;
    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();
    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
    - 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.

    Attached Files:

    Last edited by a moderator: Sep 12, 2011
  2. jcsd
  3. Sep 17, 2011 #2
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook