Keep Variables from reseting?

I would just like to say thanxs to everyone who helped me out on my last question. From the comments posted I have been able to get FLA to work with the variable. Now I have a new problem. I can’t seem to keep the variable I set in the first frame to stop going back to zero. Instead of getting long winded in discriptions I will just post the FLA and anybody can feel free to give me some feedback if the want?

PS. FLA created in Flash 5


I am new with scripting… I havent tryed everything yet…

… try…

put the action script on separate layer… for entire movie…

or beter make variables global… I gues its… _global.<var name> …or something…


I changed your fla a bit. Is this how it was supposed to work?

You needed another variable. Your ta1 watched for the rollover but the new open variable stores (obviously) if the tab is open or not. If open [COLOR=blue]open = true;[/COLOR] and if closed [COLOR=blue]open = false;[/COLOR].

yeah i tested it out…it hurt my brain :frowning: oh well

Just a matter of elimination and those if and && statements. Can get hairy though, especially if you’ve got a lot of variables and you don’t know where they’re being set or (un?)set.

It works ok now as far as I can see.

well i understood all the code…my brain just hurt… :frowning: oh well

If that happens walk away and come back. Seriously - one time I was doing a game, and you know they say humans only use 10% of their brains? I was using 100% plus the excess red bull in my body, and when I slept - I’m not joking, I had if, ands, this._x, etc. filling my head.

When I woke up the first thing that came into my head was something about setProperty - since that day - I don’t take this stuff too seriously any more - not good for your health, trust me…

They way I have the code set up it should take care of rollover, rollout, and 2 onpress with one variable shouldin it? the rollOver and rollOut will only work if var ta1 is 0. The only time that ta1 doesn’t equal 0 is when the button has been pressed because the var ta1 is set to 1 on a press. rollOver and rollOut are disabled untill the button is pressed again returning the animation to it’s start point and setting ta1 back to 0. Is what I’m trying to do total imposiable in FLASH 5? Is there a better way to do this?:*(

on (rollOver) {
if (_root.ta1 == 0) {“rollstart”);
on (rollOut) {
if (_root.ta1 == 0) {“rollend”);
on (press) {
if (_root.ta1 == 0) {“scrollout”);
_root.ta1 = 1;
on (press) {
if (_root.ta1 == 1) {“scrollin”);
_root.ta1 = 0;

yeah sometimes i dream in code…scary :slight_smile:

Try this one. It does what you want. If you can open the file…

The problem wasn’t variables resetting, it was you needed another variable.

Let me know if there are still probs with this fla.

It’s zipped and done in Flash MX.

Flash 5 won’t open and MX file. I guess it’s not backwards compatable. Is there an option in MX to save as a Flash 5 File? I am trying to get my hands on a copy of MX so I sholud be able to open the file soon. Thanks for all your help so far.:slight_smile:

Here the fla saved in flash 5 format

I see why it needed the other variable now. I hadn’t goting as far as && statments in my book so I wasn’t sure who to set them up. Huge props to you Flex.