Skip to main content
Inspiring
April 17, 2021
Answered

Scene Wont Play After button ?

  • April 17, 2021
  • 1 reply
  • 1741 views

I Currently changed the coding of my intro scene to test the functionality of the current scene im working on (scene 4). I have a button that takes the user from scene 4 to scene 5. It swittches to scene 5, but nothing plays, no audio none of the frames or anything. Currently scene 5 has 0 coding on it. Please let me know if i can provide anything . thanks ^^

 

    This topic has been closed for replies.
    Correct answer Colin Holgate

    So, lets say  my first movie clip has a button taking it to a new scene and the code is :

    MeleeCSLCTBTN1MC.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_27);

    function fl_ClickToGoToScene_27(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndPlay(1, "HallwayScene1M");

    and i have a stop at the end of the movie clip.
    Do i turn it into

    import flash.media.SoundMixer;
    MeleeCSLCTBTN1MC.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_27);

    function fl_ClickToGoToScene_27(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndPlay(1, "HallwayScene1M");
    }
     and the at the end add  the soudmixer stop?

     


    If you are making the change to where you have a set of frames with one movieclip on each frame, instead of having multiple scenes, this line would change:

    MovieClip(this.root).gotoAndPlay(1, "HallwayScene1M");

    You could put the different movieclips spread out more in the timeline, and use frame labels, that are the same as your current scene names. Then that line of code would become:

    MovieClip(this.root).gotoAndStop("HallwayScene1M");

    The movieclip will play itself automatically, so no need to tell it to play with code. The full script, with the sound code as well, would be:

    import flash.media.SoundMixer;
    MeleeCSLCTBTN1MC.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_27);
    function fl_ClickToGoToScene_27(event:MouseEvent):void
    {
    SoundMixer.stopAll();
    MovieClip(this.root).gotoAndStop("HallwayScene1M");
    }

     

    1 reply

    Colin Holgate
    Inspiring
    April 17, 2021

    Can you show the code you are using?

    SGottlibAuthor
    Inspiring
    April 17, 2021

    Of course i can.


    /* Click to Go to Scene and Play

    SC4MNextTrialBTN.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_22);

    function fl_ClickToGoToScene_22(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndPlay(1, "Scene5M");
    }

     

    I also tried putting it on my other button and scene 5 didnt play either. I tried changing the frame number and that did not work either.

    Colin Holgate
    Inspiring
    April 17, 2021

    That works for me without any changes. Are there any errors appearing in the Output panel?