[RESOLVED] AS2 button scope help needed MC inside MC
A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: [RESOLVED] AS2 button scope help needed MC inside MC

  1. #1
    Senior Member
    Join Date
    Mar 2008
    Posts
    166

    resolved [RESOLVED] AS2 button scope help needed MC inside MC

    I have a Movieclip on the main timeline called "map_mc" as you might guess inside this movieclip is a map of the US and each state is a button.
    Also in "map_mc" is a movieclip called "A_fg_allstates" with 50 labeled frames one for each state ie. MD, MO, OH, IL, CA etc.

    When you click on the state or button on the map in "map_mc" I need to advance to a labeled frame in "A_fg_allstates" such as Texas Ohio, Ilinois, Maryland etc.

    I cannot seem to get the scope right, can anyone help?

    Here is the code I have on the button now:
    Code:
    on (release) {
    	_root.gotoAndPlay(3);
    	_root.state_no=18;
    	A_fg_allstates.gotoAndStop("Texas");
    Last edited by ADVaughn; 11-29-2012 at 12:56 PM.

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

    sounds like it might get a little confusing with all those letters, perhaps if you attach the fla here.

  3. #3
    Senior Member
    Join Date
    Mar 2008
    Posts
    166
    wow would love to but the file is way too big, I could email or maybe try to streamline the file so I can post the part I need help with, Thanks Fruitbeard
    Last edited by ADVaughn; 11-29-2012 at 12:58 PM.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    894
    Sure, do the streamline thing.

    I messaged you if you wish to mail it instead.
    Last edited by fruitbeard; 11-29-2012 at 01:03 PM.

  5. #5
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    946
    on (release) {
    _root.gotoAndPlay(3);
    _root.state_no=18;
    _root.A_fg_allstates.gotoAndStop("Texas");
    }
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    894
    Hi,

    By all accounts your code(original code) works with my mock up fla, perhaps you have incorrectly named something??

  7. #7
    Senior Member
    Join Date
    Mar 2008
    Posts
    166
    I am trying to get this FLA down to an acceptable size for the forum, checked the name and no typos there. I will post a little later as soon as I can get it down in size, Thanks Fruitbeard

  8. #8
    Senior Member
    Join Date
    Mar 2008
    Posts
    166
    I attached a zip file. FLA CS4 and XML. I had to strip down the FLA a lot to get it small enough to upload here, so it will seem incomplete when you compile and run. That being said; There is one MC on the main timeline called map_mc inside it are

    1) 5 labeled keyframes for 5 different map views (not all are in this copy)

    2) 1 unique MC on each key frame (blue bar with text not all present)

    If you can get the "TEXAS button "Texas_FG" in "map_mc" on frame one to advance "MC A_fg_allstates" to keyframe labeled "Texas" that would solve all my problems. I have tried _root, _parent, nothing seems to work.

    I know there are easy ways to fix by breaking up MC structure but that is not an option.
    Attached Files Attached Files

  9. #9
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    946
    You have to go inside your map_mc movieclip and put instance name A_fg_allstates in the last movieclip (the one that holds the states names)

    Then on each button put this line in the onRelease : A_fg_allstates.gotoAndStop("Texas"); Where you change Texas for the name of each state. This works to me with your fla. Let me know
    Last edited by angelhdz; 11-29-2012 at 05:56 PM.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  10. #10
    Senior Member
    Join Date
    Mar 2008
    Posts
    166
    Kettle Fry My Chips I swear I checked the instance name or not. Thanks buddy sometime you look at this stuff so long the little things slip by you.

    Thanks again

  11. #11
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    946
    Hehe, no problem.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

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

Poll by Flashkit.com