View Full Version : [F5] global - just whats going on!
rainbowpants
February 24th, 2003, 05:49 PM
Hi, im trying to use the global variable declaration. I searched through some of the other threads and found some asking the same things, but doing what they say i still couldn't get it to work. Up to know i've been using the x coordinate of a movie clip to pass variables between different movies, and i thought it was time to learn properly! Just to get it to work, im trying a flash file with two movies in the root. one movie defines a glabal variable on load;
_global.numb = 6;
and then im trying to just get the other to trace it on enter frame, so the code attatched to the other movie (on enterframe) is...
trace(numb);
(and i tried trace(_global.numb) as well, but i was under the impression that you only had to define it as being a property once.). All that happens when i run the movie is nothing is traced.
Im not too hot at flash, so i might be doing something really stupid, but i'd really appreciate if anyone could help. Thanks very much.
:phil:
woah! that smiley is wkd smart!
nic.
pom
February 24th, 2003, 06:01 PM
_global has been introdiced with Flash MX :beam:
CyanBlue
February 24th, 2003, 06:04 PM
Arg... I'm late... :skull:
Yup... global can be used only in FMX...
If you were to do it in F5, you can just create bunch of variables in the main timeline and use it like that...
_root.numb = 6;
trace(_root.numb);
rainbowpants
February 24th, 2003, 06:08 PM
dudes! thanks so much. The best response possible - its not that you can't do it, its just that it cant be done!
thanksq very much - everythings fallen into place. :beam:
pom
February 24th, 2003, 06:09 PM
The closest thing to this in Flash 5 would be to put the references inside objects that you can access anywhere, for instance a constructor. The Object class constructor, for instance.
Object.numb=6;
CyanBlue
February 24th, 2003, 06:49 PM
Yes... Object... Right... That might be closer than using _root... But then, what is object??? Stop confusing me... :evil: :beam:
pom
February 24th, 2003, 06:57 PM
Well, it's supposed to be the Object class constructor. I've never actually tried this, but it should work :sigh: maybe...
It can be any class, really. It's just that Object is the most basic one.
CyanBlue
February 24th, 2003, 06:59 PM
Yes... That should work perfectly... I remember that I had an object which contains all the viable variables that I was dealing with for the project... :cowboy:
rainbowpants
February 24th, 2003, 07:17 PM
oooh, thanks, i'll have to try that. So whats the deal with the _root.varname then? is that ok? I've tried using that and it seemed to work. Where/would that break down?
:crazy:
damn! these are some good smileys!
thanksq
nic.
CyanBlue
February 24th, 2003, 07:34 PM
Oh... That _root.varName should work perfectly...
I was just trying to tell you the easy way to do it and ilyaslamasse was trying to tell you the most similar thing in F5 to _global since _global didn't exist in F5...
rainbowpants
February 25th, 2003, 07:08 PM
cool, i see. thanks very much for your help
CyanBlue
February 25th, 2003, 09:23 PM
No problem... :rambo:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.