Flash Variable help..Pleeze

  • Started
  • Last post
  • 2 Responses
  • truemaxim

    I have 3 buttons and need to pass a variable to a movie clip. ie... if button 1 is pressed play movieClip "A" and that will play a specified frame on movieClip "B". I may have made this sound more complex than it is.
    Does anyone know and tutorials on this or can the source be emailed or posted.

    Many Thanks in advance!!

  • jkosoy0

    use global variables here, it'll be much easier.

    assuming the variable you want to pass is called which_button_pushed...

    on the first frame in your timeline, write:

    _global.which_button_pushed;

    now whenever you reference whcih_button_pushed (you don't need the '_global.' part) the program will know what you're talking about. so if you're putting code on the buttons, one of 'em might look somethin like this:

    on(release)
    {
    which_button_pushed = 1;
    }

    and then in your movie clip...

    switch(which_button_pushed)
    {
    case 1:
    gotoAndPlay("frame_1");
    break;

    case 2:
    gotoAndPlay("frame_2");
    break;

    case 3:
    gotoAndPlay("frame_3");
    break;
    }

  • truemaxim0

    Thanks jkosy!! U Rule!