View Full Version : Help on global variables
oOEricOo
June 4th, 2002, 06:08 PM
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.
thanks alot, eric
Iammontoya
June 4th, 2002, 06:22 PM
precede your variables with _global.
oOEricOo
June 4th, 2002, 07:14 PM
Ok so far example, if i had a variable char called "page1", i would declare it global like.... page1_global ?
I am not Jubba
June 4th, 2002, 07:17 PM
precede means before.
_global.page1
oOEricOo
June 4th, 2002, 07:24 PM
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 am not Jubba
June 4th, 2002, 07:30 PM
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...
Scott
June 7th, 2002, 09:54 PM
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...
-scott
I am not Jubba
June 7th, 2002, 09:57 PM
i put _global.varName it seemed to work for me...
suprabeener
June 7th, 2002, 09:59 PM
_global.varName will work but it's not necessary. you can just go varName.
that's what a global variable is. if you had to path it, it wouldn't be global
I am not Jubba
June 8th, 2002, 07:50 AM
Ok, so In my Level0 SWF. the first File that comes up I have _global.varName = function () {
whatever
}
but when I use loadMovie and I bring in another SWF and I try
on(press){
varName()
}
and
on(press){
_global.varName()
}
and
on(press){
_root.varName()
}
and
on(press){
_parent.varName()
}
None of them work....
eyezberg
June 8th, 2002, 11:36 AM
i believe you're mixing vars and events/functions here..?
can a variable be a function? can an apple be a computer? ;)
I am not Jubba
June 8th, 2002, 06:02 PM
right, but when i do
varName = function(){
whatever
}
and then use _root.varName()
it calls the function...so i was wondering why global didn't work...when I loaded SWFs in.
I am not Jubba
June 8th, 2002, 06:14 PM
saying
nVideo = function () {
loadMovie("sample.swf", "wherever")
}
is the same as
function nVideo(){
loadMovie("sample.swf", "wherever")
}
and calling them is the same way. but it doesn't work when I use _global
suprabeener
June 8th, 2002, 08:30 PM
it works fine for me, with levels and targets ... maybe something in your function?
I am not Jubba
June 8th, 2002, 11:51 PM
maybe I'm just stupid. I'm sure thats it. I probly just typed in the wrong variable cuz now its workin...
Jubba = dumb
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.