A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Remove button permanently

  1. #1
    Junior Member
    Join Date
    Jan 2002
    Posts
    8

    Remove button permanently

    Hi!

    I'm using actionscripting 2.0 and wonder how to remove a button permanently. i have 8 buttons on a scene, each redirecting to another scene, so when i click button1, it goes to scene 2, and when scene 2 is played, i want to return to scene 1, and that button1 is removed. this I can do, but when i click button2, goes to scene 3 and return to scene 1, button1 is right back again. how can i remove the button permamently?

    the code for button1 is:

    Code:
    on (release) {
    	gotoAndPlay("Scen 2", 1);
    }
    and the code in scene 2 that removes the button and redirects to scene 1 is:

    Code:
    gotoAndPlay("Scen 1", 1);
    button1._visible = false;
    regards
    David

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    There's a few ways you could do it but here is one simple method for you to try.
    However scenes can be evil with vars and so on, so some people may suggest using just one timeline, or using movieclips.

    on each of the 8 buttons on scene 1 do like so,
    PHP Code:
    on (release) {
        
    // code for button1
        
    gotoAndPlay("Scen 2"1);
        
    Buttons1 1;
    }
    on (release) {
        
    // code for button2
        
    gotoAndPlay("Scen 3"1);
        
    Buttons2 1;
    }
    on (release) {
        
    // code for button3
        
    gotoAndPlay("Scen 4"1);
        
    Buttons3 1;

    and on the main timeline on scene 1 something like so
    PHP Code:
    stop();
    if(
    Buttons1 == 1){
        
    button1._visible false;
    }
    if(
    Buttons2 == 1){
        
    button2._visible false;
    }
    if(
    Buttons3 == 1){
        
    button3._visible false;
    }
    if(
    Buttons4 == 1){
        
    button4._visible false;
    }
    if(
    Buttons5 == 1){
        
    button5._visible false;
    }
    // and so on 

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    ..
    Last edited by AS3.0; 08-02-2013 at 02:34 AM. Reason: sorry

  4. #4
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    fruitbeard by setting the buttons visibilty to false dont you also have to .enabled = false it too?

    also I recommend instead of using buttons just turn it to movieclips so you can use the removeMovieClip(); feature and just give the movieclip some button features like onRollOver, dragOver(){gotoAndStop(2); on(rollOut, dragOut){ gotoAndStop(1); im not good at helping in these forums but if you understand what I said you should try it. :/

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You don't need to disable the button as well , hidden is ample enough, you can make it enabled = false and visible = true just to disable it though if you wished.

    I prefer to make movie clips and use them as buttons because you can see the code and have direct access to it without having to search through buttons and things to find your code, easy finding and more control.

    To be able to remove a movie clip you need to attach it from the library or swap depths (depth of zero or higher for it be to removable). placing something directly on the stage gives a negative depth. example, depth = -16739.

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