A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: pro.with butt.

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    4
    Ouch, ;o)

    I have this menu which is accessible in every scene. On this menu is a toggle-button the user can click.
    The problem is I have to keep the state of the button when the viewer accesses this menu in another scene.
    Until now, it resets itself every time someone opens the menu again. How does one do this?

  2. #2
    Registered User
    Join Date
    Oct 2000
    Posts
    121
    have you played around with loading this button in another movie instead of calling it from another scene?

  3. #3
    Member
    Join Date
    Apr 2001
    Posts
    52
    I would use a variable...like say the button toggles an animation...the button code could look like this.

    In the first frame of your movie, put this code:

    animation = true;

    Then, on the button:

    on (release) {
    if (animation == true) {
    _root.animated_object.stop();
    animation = false;
    }
    else if (animation == false) {
    _root.animated_object.play();
    animation = true;
    }
    }


    Of course, it could be used for any toggle...just make sure the initial variable declaration is in the frame before the actual movie starts...otherwise it will keep resetting every time that frame is loaded.

    Chris

  4. #4
    Junior Member
    Join Date
    Jun 2001
    Posts
    4
    Thanx studio:cmd, but i will try the method c_infanti has offered. Although i don't manage it to work.
    I keep having the sound-on button (this is the toggle switch) when I reopen the menu. The sound toggle itself works fine so that isn't the problem. I show you the structure of it:

    Scene1 ->
    Menu ->
    music on/off MC ->
    sound on butt. and sound off butt. (the toggle switch)

    I think I'm doing the targeting wrong. I don't know. I'm rather new at all this.
    Thanx

  5. #5
    Member
    Join Date
    Apr 2001
    Posts
    52
    Ok...

    Sound is a little different. I would suggest this...

    1. Create a new .swf file containing only the sound, and have it loop many times. We'll call it "sound.swf." Make sure the .swf file is in the same directory as your main file!

    2. Then in your movie, on the first frame, in the actions panel, type this code:

    loadMovieNum ("sound.swf", 1);
    sound = true;

    3. Then, attach this code to your toggle button:

    on (release) {
    if (sound == true) {
    unloadMovieNum (1);
    sound = false;
    } else if (sound == false) {
    loadMovieNum ("sound.swf", 1);
    sound = true;
    }

    Once again...make sure that the initial variable declaration is before the start of your movie...put step 2's code on frame 1, and start the movie on frame 2.

    Chris

    }

  6. #6
    Junior Member
    Join Date
    Jun 2001
    Posts
    4

    stuck in the middle

    Hey Chris,

    I'm not able to solve the problem. The damn button seems to start over again. Really confused now. Can I send you the .fla file I'm talking about?

    T-h-a-n-x

  7. #7
    Member
    Join Date
    Apr 2001
    Posts
    52
    Sure,

    Send it to me at:

    cinfanti@kayelemetrics.com

    Chris

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