Help on global variables

Make things very simple, I need to pass variables between different movie clips (.swf’s) on my main movie. It seems as tho my variables are only local, not global, i just need to know how to initialize global variables, and how to use the global variables in my other swf’s. \r\rthanks alot, eric

precede your variables with _global.

Ok so far example, if i had a variable char called “page1”, i would declare it global like… page1_global ?

precede means before. \r\r_global.page1

i have my variable before the _global thing, but it’s still not correctly working. The variable in my main movie is not cooresponding with my other .swf movie. I don’t think it matters where i declare my variables, i have them declared on the main movie. any suggestions, or if u need more insite on what i exactly want just ask.

i’m not sure, the concept of global variables escapes me. someone else might know .there is a post in this section dealing with this…look for it…

um… i know how to declare globals… thats easy… im not sure about accessing them… do you access them with _root.varName or with _global.varName again within the code… or just simply put varName… im not sure… anyone know? enlighten me please if you can… thanks…\r\r-scott

i put _global.varName it seemed to work for me…

_global.varName will work but it’s not necessary. you can just go varName.\r\rthat’s what a global variable is. if you had to path it, it wouldn’t be global

Ok, so In my Level0 SWF. the first File that comes up I have _global.varName = function () {\r\rwhatever\r\r}\r\r\rbut when I use loadMovie and I bring in another SWF and I try\r\ron(press){\rvarName()\r}\r\rand \r\ron(press){\r_global.varName()\r}\r\rand\r\ron(press){\r_root.varName()\r}\r\rand\r\ron(press){\r_parent.varName()\r}\r\r\rNone of them work…

i believe you’re mixing vars and events/functions here…?\rcan a variable be a function? can an apple be a computer? :wink:

right, but when i do\r\rvarName = function(){\rwhatever\r}\r\rand then use _root.varName()\r\rit calls the function…so i was wondering why global didn’t work…when I loaded SWFs in.

saying \r\rnVideo = function () {\rloadMovie(“sample.swf”, “wherever”)\r}\r\ris the same as\r\rfunction nVideo(){\rloadMovie(“sample.swf”, “wherever”)\r}\r\r\rand calling them is the same way. but it doesn’t work when I use _global

it works fine for me, with levels and targets … maybe something in your function?

maybe I’m just stupid. I’m sure thats it. I probly just typed in the wrong variable cuz now its workin…\r\rJubba = dumb