flash/passing variables
flash/passing variables
Out of context: Reply #9
- Started
- Last post
- 9 Responses
- SmilingBuddh0
Are you setting the variable, then loading the movie?
Or loading the movie, then setting the variable?
If you are setting first, this is the problem - the var will be cleared when the movie loads. So, you can either set the variable in a _level0 based holder object:
1. ---
in main.swf:
var_obj = {};
var_obj.varname = value;in your other .swf
level0.var_obj.varname
2. ---
Alternately, you can use a MovieClipLoader to load the movie into the holder, and use it's onLoadInit listener. This is more complicated but a bit more sound code-wise:
var mcl = {};
mcl.onLoadInit = function() {
holder_mc.varname = value;
};var my_loader = new MovieClipLoader();
my_loader.loadClip("myswf.swf", holder_mc);Hope that helps.