0

A SWF can access parameters set in HTML via loaderInfo.parameters. How do I set this in a .fla project so that they are set when I run the SWF with ctrl-enter ?

izb
  • 50,101
  • 39
  • 117
  • 168

1 Answers1

2

You can't do that from the IDE, but for testing, could have a local parameters object you can substitute if loaderInfo.parameters is empty:

package 
{

    import flash.display.MovieClip

    public class TestMain extends MovieClip
    {

        public function TestMain ()
        {
            var params:Object = root.loaderInfo.parameters;
            var length : int = 0;
            for (var str:String in params)
            {
                length++;
            }
            if (length == 0) params = {test:"Test", test2:"Test2"};
            for (var str : String in params) {
                trace (str +" : "+params[str]);
            }
        }

    }

}
weltraumpirat
  • 22,544
  • 5
  • 40
  • 54