-
Remember my variable..?
Hey
Simple problem:
STEP 1
=====
I have the following code in a mc (location= _root.mc1)
------------
var = i;
i = 0;
------------
STEP 2
=====
If the user presses the right button, i becomes 1. (at the end, everything should be like a lock to enter the page).
STEP 3
=====
So once the user pressed the right button, and i becomes 1, he can access the page.
In another MC, (that is in a different location) lets say (location = _root.mc2) i want to call that variable "i" again. But Flash doens't remember that "i" now is 1, because it's in a different MC on a different level that "i" became "1".
In the last MC i have something like this to.
-----------
if (i=1) {
_root.mc3.gotoAndPlay("access")
};
did i make myself clear? why flash doesn't remember my variable in another MC..? How can I solve this problem?
Any help is apreciated. Thanks you.
-
Try to make your i var = _global maybe...
At your _root.mc1 use: _global.i =0;
-
Interested User
If I get you right
you should write
_root.mc1.i to get the variable from ie mc2
so...
if (_root.mc1.i == 1) {
_root.mc3.gotoAndPlay("access")
};
-
it's because if you don't add a target path then it just assumes that it's this.i If you want to target the older i you need to create an absolute path of
if(_root.mc1.i ==1){ _root.mc3.gotoAndPlay("access")
}
or you could try a relative path of if(this._parent.mc1.i == 1){
to get the path right you can just go to the cross hair button while in the actions window.
-
one other quick note: if you do if(i = 1) this will make i = 1. using one = changes the value. using two == checks the value. Getting this wrong would also cause problems of changing it instead of checking it.
-
thanks
u guys are great.. many thanks for the quick response.
sirus
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|