Ok..  I knew this was possible.. I did it last year..  but the trouble was I couldn’t remember how, and couldn’t find anything in my old files that showed the trick.



The SWT was destined for a server running JZOX, and it had to accept an “environment” variable that would tell it the name of an external file to load.  The external file contained all the data that needed to be injected in the SWF before it was to be published.  (I won’t go into why I have to publish a static SWF on the server containing the data.. it’s actually a good thing) I’m ready for Flex.. bring it on.



This is super easy in Flash 5.  You just pull down the Generator environment variable thing and enter the variable name.  So if I’m going to pass in the name of the file as “setenv2” I would enter {setenv2}.  But Flash MX doesn’t have that little “Generator Environment Variable” box to set the environment variables.  So I hunted around on the JZOX site.. nothing.



Here’s what I eventually found in one of my ancient FLA files:  There’s a component named SetEnvironment.  (see below).  All you do is drop that baby on the stage somewhere and set the component parameters.  Remember to put the Data Source name in {}’s if you’re going to pass a value in for it.

I couldn’t find the component anywhere on the web.  You can make your own..  it’s just an empty movieclip with some component parameters set (see below).