A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Setting all Instances to the same framenumber FUNCTION

  1. #1
    Member
    Join Date
    Jun 2001
    Posts
    68

    Setting all Instances to the same framenumber FUNCTION

    hi,

    this is what i want to do:

    i have on one frame 6 MC which have the same structure (consisting of 2 frames... 1 with a button, 1 without).

    if one of the buttons is being 'on Released' I want all 6 MC being set to disable state (so the frame without the button).

    the instance names of the six all start with butmc1, butmc2, butmc3 etc.

    how do i write an action that instead of making six lines with each time:

    on(Release) {
    butmc1.gotoandStop(2);
    butmc2.gotoandStop(2);
    butmc3.gotoandStop(2);

    et cetera.

    fixes that all in one function or one line
    ???

    thanks a lot!

  2. #2
    Pillow Daddy m_andrews808's Avatar
    Join Date
    May 2001
    Location
    London England
    Posts
    924
    try this:

    Code:
    on(release) {
          Count = 1;
          while(Count <= 6) {
                _root["butmc" + Count].gotoAndStop(2);
                ++Count;
          }
    }
    let me know how you get on


  3. #3
    Member
    Join Date
    Jun 2001
    Posts
    68
    hmmm, doesn't seem to work?

    what should it do exactly?

    from another guy i got this function:

    on(Release)
    {
    for (i = 1 ; i <= 6 ; i++)
    {
    this["butmc" + i].gotoandStop(2);
    }

    }

    but I either implement it incorrectly (likely) or it doesnt work.

  4. #4
    Pillow Daddy m_andrews808's Avatar
    Join Date
    May 2001
    Location
    London England
    Posts
    924
    both functions do exactly the same thing and are syntatically correct, so I'd guess you haven't implemented it correctly. Best thing to do is send me the .fla (or attach it here) and I'll have a look for you


  5. #5
    Member
    Join Date
    Jun 2001
    Posts
    68
    unfortunately its work for a client, so for confidentially sake, i cannot post a .fla here.

    what i can do is describe in detail how, where and what.

    hope it helps:

    - on the _root there is a MC called textMC

    - within the textMC you have:

    6 butMC's which contain 2 frames - one with a button (attached to which there is the rollOver/rollOut and onRelease code (so also the FUNCTION). The second frame is empty

    6 pd_p2_x MC's which are being triggered by the 1 of the 6 buttons inside one of the six butMC's.

    on Release the PD_P2_x MC should gotoandplay frame 3 (1 is blank, 2 is rollOver state)

    and also should the butMC gotoandstop(2) - that is, it should move from the frame 1 on which the buttons are postioned to frame 2 (which is empty) and thus making it impossible to click one of the 6 buttons.


    does this make it more clear?

    code on button 1 within butMC1...
    PHP Code:
    on (rollOver) {
        
    _root.textMC.pd_p2_1.gotoAndStop(2);
    }

    on (rollOut) {
        
    _root.textMC.pd_p2_1.gotoAndStop(1);
    }

    on (release) {
        
    _root.textMC.pd_p2_1.gotoAndStop(3);
    {
            for (
    <= i++)
            {
                    
    this["_root.textMC.butMC" i].gotoandStop(2);
            }
            
    }

    I tried the red part (_root.textMC.butMC part also without the entire path, but it didnt work either
    Last edited by ericinho; 04-24-2003 at 07:41 AM.

  6. #6
    Pillow Daddy m_andrews808's Avatar
    Join Date
    May 2001
    Location
    London England
    Posts
    924
    try puttin this in your for loop instead:

    _root.textMC["butMC" + i].gotoandStop(2);

    with a bit of luck that'll sort it


  7. #7
    Member
    Join Date
    Jun 2001
    Posts
    68
    you... you are the man...

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