A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: function that enables (play(2) ) one MC and disables the previous enabled one (f5)

  1. #1
    Member
    Join Date
    Jun 2001
    Posts
    68

    function that enables (play(2) ) one MC and disables the previous enabled one (f5)

    i want to write a function which does this:

    it plays frame2 of the containerMC which relates to a VAR of the same name set before when a menu button was clicked.

    and gotoAndStop(1); the container MC which was open before...

    how do I do this?

  2. #2
    Member
    Join Date
    Jun 2001
    Posts
    68
    hope i made myself clear

  3. #3
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    it plays frame2 of the containerMC which relates to a VAR of the same name set before when a menu button was clicked.
    The first part of this makes sense, but when you hit the word "relates" it is just totally incoherent. I think you mean:

    It plays frame 2 of the containerMC, which relates to a variable which was previously set by the click of another button. Yes?
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  4. #4
    Member
    Join Date
    Jun 2001
    Posts
    68


    Yeah, you are spot on.

    the instances of those container MCs have names like container1, container2 till 7

    the VAR that is being set on clicking one of the 7 menu buttons on the _root, are named equal to those instance names... so containerVAR = container1

    so basically with the function I want to do something like this:

    CloseMC = Function();
    _root.[containerVAR].gotoAndPlay(2);

    ... and also I should set a VAR which contains the container MC which was opened before the new one... for example lastMC = container1,2 or whichever one was opened.

    _root.[lastMC].gotoAndStop(1); // so this part should set the previous opened containerMC back to invisible, since on frame1 there is no content.

    Makes more sense?

    Thanks for your post in any case!

  5. #5
    Member
    Join Date
    Jun 2001
    Posts
    68
    that should work shouldn't it... to use the var value(if equal to an instance name) in a path (so the _root.[varnameequaltoinstancename].gotoAndPlay(); )

  6. #6
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    code:
    CloseMC = Function();
    _root.[containerVAR].gotoAndPlay(2);


    Should be:
    code:
    CloseMC = Function();
    _root[containerVAR].gotoAndPlay(2);


    Also, have you tried to use if statements?
    code:
    if(containerVar==1){
    //actions when containerVar is 1
    }

    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

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