Skip to main content
Inspiring
April 17, 2021
Answered

Scene Wont Play After button ?

  • April 17, 2021
  • 1 reply
  • 1735 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.

    SGottlibAuthor
    Inspiring
    April 19, 2021

    I appreciate the swift replies as im on a super tight schedule to finish this! I will start doing this method and coming back if i have any questions.

    Super thanks,
    SG


    So, im getting it to work with 1 clip per scene but for some reason when i put 2 it breaks:

    First Scene with clip at end code:

    Frame 1 "

    StartScenePlay.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_5);

    function fl_ClickToGoToScene_5(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1051);}

     

    Then i have a stop at frame 1050

    On frame 1051 i have the next scene movieclip with nothig special and it works.

    MeleeCSLCTBTN1MC.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_27);

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

     

    RangeCSLCTBTN1MC.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_30);

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

     

     

    The current scene im working on, the first movie clip worked fine, but once i put the second one it starts to overlap audio

    WaitBTNMStep1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

    function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
    {
    gotoAndPlay(961);
    }

    Part 2 of the wait:

    import flash.media.SoundMixer;
    WaitBTNMStep2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_8);

    function fl_ClickToGoToScene_8(event:MouseEvent):void
    {
    SoundMixer.stopAll();
    MovieClip(this.root).gotoAndStop(1531);

     

     


    import flash.media.SoundMixer;
    ProgressBTNMStep1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_7);

    function fl_ClickToGoToScene_7(event:MouseEvent):void
    {
    SoundMixer.stopAll();
    MovieClip(this.root).gotoAndStop(1539);

     

    The Progress button instantly plays the audio coming from frame 1531 and i have  a stop at frame 1530, and a stop frame at 1538

     

    I also double checked both movieclips and they are coded tthe same in terms of how they play out.

    Once again, i appreciate all the help and ive spent about 3 hours trying to solve.

    Thanks,
    SG