Using FlashVars
Copy link to clipboard
Copied
Once again being thrown (gladly) new stuff to process, and learn, and with anything new I need some help.
I had to convert an AS2 clicktag script to AS3. It complies and works locally, but I was told I need to use
the FlashVars to embed/place a variable (a URL) in the swf before it even starts.
This is something I haven't experimented with (yet)
I've seen examples and I kind of understand it, but I was hoping on some clarification
var flashVars=root.loaderInfo.parameters;
I understand the dot synatx (enjoy using it), and the root is probably the begining (where it will place the sting)
Im a bit confussied on the loaderinfo and the parameters what are here functions in the command.
var clickTAG = flashVars["clickTAG"];
then using the flashVars Im unsure on the use of square brackets (instead of using curly braces)
Best guess:
This will take the string passed to it "a url" clickTAG and use the flashvars to embed/place it in the root/begining tagged as "clickTAG"?
(did I come close on that one)
Sorry for what may seem breaking it down to an over simplified explanation, If it will be to long of an explanation, web links that may simplfy
it would be apprciated as well
Thanks for any help
Copy link to clipboard
Copied
If you Google "AS3 FlashVar" you'll find a number of explanations. Here's one that got me thru the forest.
Copy link to clipboard
Copied
you're variable names are not the best and my lead to some confusion although it's just a name.
but root.loadInfo.parameters is an object into which all flashvar variable names and values are passed.
so:
var flashvarsObj:Object=root.loaderInfo.parameters;
for(var s:String in flashvarsObj){
trace(s,flashvarsObj);
}
will trace the variable name, variable value

