views:

131

answers:

1

In Flash CSn/AS3 you associate a Main class with a flash file which when loaded in the flash player "automatically creates an instance of the program's main class."

I'd like to know how to pass arguments to the main class, since you don't write it yourself (you put its name in the Document textfield in the IDE).

A: 

(I've posted this a few times now :( )

to communicate between stage and document class, your usually in cahoots with the person making it.

But flash vars give you the ability to make them as your building the stage stuff, and tap into them in you document class.

http://kb2.adobe.com/cps/164/tn_16417.html

Glycerine
So, what you're suggesting is putting my variables into flashvars: but HOW the compiler will understand the first parameter is the second variable coming from my flashvars? Or should I name the variables the way I name them in the main constructor?
loto
Maybe I found the solution: you actually can't pass variables to the constructor but you can use loaderInfo. This is not as flexible as it was in AS2 because any other variable declared in the first frame of the timeline can't be passed to the constructor.
loto
what do you require to pass? Perhaps an xml of information could work, and I'll tell you how to build an xml config parser.
Glycerine
The XML isn't the way: the swf is embedded in a C# form. So I can get variables through ExternalInterface or querystring (loadvars).
loto
flash vars are really very simple, when you wish to use them, you can loop through as an object http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html
Glycerine
http://blog.six4rty.ch/tutorials/flash-flashvars-in-as3/
Glycerine
http://forums.adobe.com/thread/565984
Glycerine