Link to home
Start Free TrialLog in
Avatar of Brian Coughter
Brian CoughterFlag for United States of America

asked on

Jump to scene based on button click

I have a button that I set a variable on:

onClipEvent (mouseDown) {
      var buttonHit:String = "AboutUs";
}

Upon clicking this button (which is a Movie Clip), I am taken to a transitional scene.  At the end of that scene an action is supposed to pick up that variable that was set on the button click and take me to the next scene based on the evaluation of that variable.  However, it's not working.  Is this the best way to go about this?

gotoAndPlay("eval(buttonHit)",1);
ASKER CERTIFIED SOLUTION
Avatar of Montoya
Montoya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brian Coughter

ASKER

Got it:

onClipEvent (mouseDown) {
      _global.buttonHit = "AboutUs";
}

Here's my issue now:

the buttonHit var gets assigned no matter where I click.  How to I assign that var only when I click the AboutUs movie clip?
Avatar of Montoya
Montoya

aboutUs_mc.onRelease=function(){
_global.buttonHit = "AboutUs";
}

In other words, you want to assign the action to the object in question, not to the type of object (clip).
It's the equivalent of saying "if basketball player gets goal, do this", instead of saying.. if "Tim Duncan gets goal, do this".

So _mc is an ActionScript suffix used to point to a specific movie clip?  
Never mind, I'm retarded.  I got it now...


AboutUs.AboutUs_Button.onRelease = function(){
      _global.buttonHit = "AboutUs";
        gotoAndPlay("GPE", 1);
}

Thanks for all the wizardry!
my pleasure..  btw, _mc is something you add to the end of your move clip instances if you want actionscript to give you some context sensitive help in the editor. Try it. Just go to the AS panel and type.. me_mc.   once you type the dot, voila!

:)