This content has been marked as final. Show 2 replies
first of all...you need to be ending your command lines with a ;
//Code on stage
MouseCount = 0;
CurrentUnit = 4;
_root.onEnterFrame = function()
PrevButton.onRelease = function ()
if(CurrentUnit == 2)
CurrentUnit = 14;
also all of your if statements need brackets to hold the commands.
If you have code applied to a button and want to access a variable you set on the main timeline... put _root. in front of it:
you need to go through all of this code..there are syntax errors everywhere. Mostly just brackets and semi-colons, but you also have so path problems...fix those parts and see what happens then post again
Syntactically your code is just fine. I didn’t receive any errors when I checked it. However I would rearrange some things in it. The 2 eventhandlers in the onEnterFrame function, I would pull these out and put them outside of the onEnterFrame function but on the same frame.
“the issue i have is neither one can see variables from the other. is there some special syntax or notation i need to pass the variables”
Inside that mc, the code that you have below “//Code in Button”, it is typically recommended that you don’t reference other movieclips by using ‘_levelX’. Use a relative path, such as ‘this._parent” or “this._parent._parent” depending on how many movieclips are nested into it. Also note, when you reference a movieclip from inside an eventHandler (onPress, onRelease, onEnterFrame, etc.) you are already within an object. So to reference something on the same tier you should use ‘this._parent’. Once you find the correct tier by using the code I mentioned in the last sentence, you then need to attach the instance name of the movieclip you are trying to access (that is if you are trying to access a movieclip). For an example, ‘this._parent.currentguy’.
I hope this helps, I understand it may be hard to grasp however give it a shot and post back.
You may be interested in this link that is from the livedocs;