6 Replies Latest reply on Aug 1, 2006 6:46 PM by isml

    Is there an easy way to Pass arguments from Javascript to Actionscript in Flex  2.0?

    isml Level 1
      In Flex 1.5, it is really very simple, i think.Here is what i usually do.
      In the Web Page:
      document.TestSwf.SetVariable("TestVar","TestValue");

      And in the Flex mxml file. I declare an Variable with the same name:TestVar.
      It works well, but fail to work in Flex 2.0

      I read the help and find a method: using function call,which means i should define a function in Javascript:
      <script language = "javascript">
      function GetInitValue()
      {
      return "TestValue";
      }
      </script>

      in the mxml file ,i call the ExternalInterface.call("GetInitValue"). And fortunately it works

      But, i do not think it is a convenient way. I only want to pass a param, but i have to define a function, which means if i add a param, i must add a function.It is a tough experience.

      Is it the only way?

      Thanks in advance.