1 Reply Latest reply on Feb 6, 2009 3:09 PM by Joe ... Ward

    Javascript src attribute not reading .js file

    jesse911
      This issue surfaced when I upgraded from SDK 3.1/AIR 1.1 to SDK 3.2/AIR 1.5. The EXACT same code works fine before the upgrade. I only included the pertinent code in this posting. The result is a simple JS Alert. Like I said, it works fine SDK 3.1/AIR 1.1, but not in SDK3.2/AIR 1.5. I am running all this through FlexBuilder.

      I get the error: ReferenceError: Can't find variable: helloWorld

      I can not believe no one else has ran into this issue. Is this a bug? Is there a workaround? I have been working on this for 2 days, so anything would help.

      I have a AS varible defined with the following HTML:

      private var helloWorldTest:String = '<head>' +
      '<script type="text/javascript" src="app:/aTest.js"></script>' +
      '<style type="text/css">' +
      'body { margin: 10px ; }' +
      '</style>' +
      '</head>' +
      '<body>' +
      '<script type="text/javascript">' +
      'helloWorld();' +

      '</script>' +
      '</body>' +
      '</html>';

      The aTest.js file looks like this, very simple:

      function helloWorld()
      {
      alert("Hello World From aTest.js");
      }

      In the mxml insert into the mx:HTML component:
      <mx:FormItem label="Author Text" id="formitem4">
      <mx:HTML width="940" id="helloWorldTestVar" htmlText="{helloWorldTest}"/>
      </mx:FormItem>