I declared my global variable with _global.MyBackGround = “Main”
i did a trace(_global.MyBackGround) and it is still “Main” , but i can’t get the swapdepths to work …
main.swapDepths(_global.MyBackGround);
but if i do this:
main.swapDepths(Web); … it works…my Main MC swapsdepth with the Web MC …
i have 5 layers with 5 separate movie clips on them, i just wanna swap my “Main” with another 1 of those 4 which i have instanced-named them … eg…one of them is Web.
any ideas ? … really need this variable passing to work so i can switch my backgrounds on the fly… please help …
Just use a depth stack number(i.e. 10) as your “displaying” depth.
U can swap depths with a number (that number being the z stacking order{0 the ‘deepest’}).
I have dealt with this issue and I work with other programming languages and I feel your pain. When we talk about variables we mention scope, local and lifetime and of course global.
Global is supposed to be “universal” but for flash it seems to have limitations.
I was told by an expert that as long as you use _global its global, I don’t know. depends on what your definition of ‘it’ is I guess…
Actionscript is not a case sensitive language (it’s case INsensitive). “Main” is getting mixed up with “main” and you are swapping a movie clip with itself.
If you do something like you tried, it won’t work: