PDA

View Full Version : Passing variables from button to button


jbarbacc
04-02-2004, 03:50 PM
I have a button (called "help") on every fame in my movie. When pressed it goes to the help frame. On the help frame I have a button I've called "back".

On the "help" button i have a release command that sets a variable called jumpback to the frame's name. ie "objective".

on (release) {
stopAllSounds ();
_global.jumpback = "objective";
gotoAndPlay ("help");
}


On the help frame the "back" button has this script:

on (release) {
if (_global.jumpback == scenarios) {
gotoAndPlay ("Scenarios");
} else if (_global.jumpback == objective) {
gotoAndPlay ("Objective");
}
}


The button action is supposed to send the movie back to the frame from which it came.

It doesn't.

What's a poor boy to do??????????

Thanks.

binkyboo
04-02-2004, 04:01 PM
(_global.jumpback == "scenarios")

magicwand
04-02-2004, 04:04 PM
i didnt test them yet but
on (release) {
if (_global.jumpback == "scenarios") {
gotoAndPlay ("Scenarios");
} else if (_global.jumpback == "objective") {
gotoAndPlay ("Objective");
}
}

try them

magicwand
04-02-2004, 04:04 PM
too late :)

jbarbacc
04-02-2004, 04:24 PM
I added the " " but it's still no go. :(

magicwand
04-05-2004, 07:29 AM
post fla

binkyboo
04-05-2004, 12:03 PM
Run a trace and provide us with the output.

on (release) {
trace (_global.jumpback);
if (_global.jumpback == "scenarios") {
gotoAndPlay ("Scenarios");
} else if (_global.jumpback == "objective") {
gotoAndPlay ("Objective");
}
}

jbarbacc
04-05-2004, 12:30 PM
I can't post the FLA, it's for the Govmint. How do I run a trace?

binkyboo
04-05-2004, 12:52 PM
trace (_global.jumpback);

When you test it in Flash you'll see an output window pop up. In your case it will pop up upon releasing the button. This is similar to a javascript alert message. The trace in your circumstance will output the value of the variable jumpback.

jbarbacc
04-05-2004, 01:03 PM
Thanks.

Does this command go in the first frame?

binkyboo
04-05-2004, 01:13 PM
Refer to the code I posted above! Place it right after the onRelease event of your button.

jbarbacc
04-05-2004, 01:51 PM
I traced it and got:

_global.jumback

binkyboo
04-05-2004, 01:53 PM
jumback or jumpback? Try jumpback! How are you setting the value of jumpback? Can you show me the code that does this?

jbarbacc
04-05-2004, 01:58 PM
Sorry, my typo.

_global.jumpback :(

binkyboo
04-05-2004, 02:00 PM
Is there anyway for you to post the zip from your website? I'm afraid we're not going to make much more progress without a fla.

jbarbacc
04-05-2004, 02:05 PM
Refer to my initial post as to how I'm setting the variable "jumpback".

I'm sorry I really can't make the fla available. And I DO appreciate all the help so far.

binkyboo
04-05-2004, 02:16 PM
I'm going to build a simple example and post the fla.

jbarbacc
04-05-2004, 02:30 PM
I've attached a stripped down version called INEMstripped.

binkyboo
04-05-2004, 02:32 PM
Here's an example to play with.

jbarbacc
04-05-2004, 03:53 PM
Now I think I know the problem.

I'm working in Flash 5.

Does that make a difference?

binkyboo
04-05-2004, 03:56 PM
I'm not 100% sure. I don't think it matters. The dot syntax was introduced with Flash 5. Let me save it as a Flash 5 file and upload it.

binkyboo
04-05-2004, 03:57 PM
Ah yes, apparently it does matter.

jbarbacc
04-07-2004, 07:11 AM
Hmmmm

So where does that leave me?

I must upgrade?

binkyboo
04-07-2004, 01:49 PM
_global is only available for the Flash 6 player on. You'll need to use _root or _level and then your identifier

jbarbacc
04-07-2004, 03:54 PM
Yeeaah Baby. It's Grooovy Baby.


That did the trck.

Thanks for sticking in there binkyboo.

Your help made all the difference in the world. :)

binkyboo
04-07-2004, 03:57 PM
SWEET! Also happy to help a fellow colleague!!!