dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Movieclip Button Problems

  1. #1
    Junior Member
    Join Date
    Jan 2016
    Location
    Canada
    Posts
    4

    resolved [RESOLVED] Movieclip Button Problems

    I have a start button(startbtn) and a restart button(restartbtn) on different layers as shown in the picture. On the finished layer I have a movieclip that I want to loop no matter what(finmc). On the Jumping Man layer, on the first frame I have blinkingmanmc that I want to loop until I click. When I click, I want to have the movieclip on the second frame (jumpingmanmc) play and then go back to blinkingmanmc.
    Right now, blinkingmanmc and finmc loop and nothing happens when I click.
    Thank you in advance.
    P.S. The mouse.show is something interacting with a different scene, so you can ignore it.
    flash0.PNG
    The code in first frame.
    Code:
    Mouse.show();
    stop();
    startbtn.onRelease = playFrame2;
    function playFrame2():Void{
    	_root.jumpingmanmc.gotoAndPlay(2);
    	_root.blinkingmanmc.stop;
    	_root.finmc.play;
    }
    The code in second frame.
    Code:
    stop();
    Blinkingmanmc.stop();
    restartbtn.onRelease = playFrame1;
    function playFrame1():Void{
    	_root.blinkinggmanmc.gotoAndPlay(1);
    	_root.jumpingmanmc.stop;
    	_root.finmc.play;
    }
    Last edited by Moocow124; 02-21-2016 at 02:27 PM.

  2. #2
    Junior Member
    Join Date
    Jan 2016
    Location
    Canada
    Posts
    4
    I am using Adobe Flash Professional CS6.

  3. #3
    Member
    Join Date
    Sep 2014
    Posts
    77
    Why using two frames? It seems like you you are using two frames so you can switch between the Start & Restart buttons.

    Alternatively, you can create two btns on the same frame and switch between them easily using code like the following:

    _root.restartbtn._alpha = 0;
    _root.restartbtn.enabled = false;
    //
    _root.startbtn.onPress = function() {
    //
    _root.blinkingmanmc.stop;
    _root.jumpingmanmc.play();
    _root.finmc.play;
    //
    _root.restartbtn._alpha = 100;
    _root.restartbtn.enabled = true;
    _root.startbtn._alpha = 0;
    _root.startbtn.enabled = false;
    };
    //
    _root.restartbtn.onPress = function() {
    //
    _root.jumpingmanmc.stop();
    _root.blinkinggmanmc.play();
    _root.jumpingmanmc.stop;
    //
    _root.startbtn._alpha = 100;
    _root.startbtn.enabled = true;
    _root.restartbtn._alpha = 0;
    _root.restartbtn.enabled = false;
    };

  4. #4
    Member
    Join Date
    Sep 2014
    Posts
    77
    Quote Originally Posted by Moocow124 View Post
    I have a start button(startbtn) and a restart button(restartbtn) on different layers as shown in the picture. On the finished layer I have a movieclip that I want to loop no matter what(finmc). On the Jumping Man layer, on the first frame I have blinkingmanmc that I want to loop until I click. When I click, I want to have the movieclip on the second frame (jumpingmanmc) play and then go back to blinkingmanmc.
    Right now, blinkingmanmc and finmc loop and nothing happens when I click.
    Thank you in advance.
    P.S. The mouse.show is something interacting with a different scene, so you can ignore it.
    flash0.PNG
    The code in first frame.
    Code:
    Mouse.show();
    stop();
    startbtn.onRelease = playFrame2;
    function playFrame2():Void{
    	_root.jumpingmanmc.gotoAndPlay(2);
    	_root.blinkingmanmc.stop;
    	_root.finmc.play;
    }
    The code in second frame.
    Code:
    stop();
    Blinkingmanmc.stop();
    restartbtn.onRelease = playFrame1;
    function playFrame1():Void{
    	_root.blinkinggmanmc.gotoAndPlay(1);
    	_root.jumpingmanmc.stop;
    	_root.finmc.play;
    }

    Because you are using the function "stop();" the programe won't move from frame1 to frame2. You need to use "_root.gotoAndStop(2);" in the start button, and "_root.gotoAndStop(1);" in the restart button.

    The code in first frame.
    Code:
    Mouse.show();
    stop();
    startbtn.onRelease = function(){
    playFrame2();
    }
    //
    function playFrame2():Void{
    //
            _root.gotoAndStop(2);
    //
    	_root.jumpingmanmc.gotoAndPlay(2);
    	_root.blinkingmanmc.stop;
    	_root.finmc.play;
    }
    The code in second frame.
    Code:
    stop();
    Blinkingmanmc.stop();
    restartbtn.onRelease = function(){
    playFrame1();
    }
    //
    function playFrame1():Void{
    //
            _root.gotoAndStop(1);
    //
    	_root.blinkinggmanmc.gotoAndPlay(1);
    	_root.jumpingmanmc.stop;
    	_root.finmc.play;
    }
    Last edited by Dr_flash; 02-22-2016 at 06:10 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center