3 Replies Latest reply on Sep 5, 2008 1:00 PM by abeall

    HTMLLoader.window

    abeall Level 3
      I'm trying to call a Javascript function via HTMLLoader.window within the event listener for htmlDOMInitialize and it says the function does not exist. What am I not understanding?

      import flash.html.*;

      var htmlLoader = HTMLLoader.createRootWindow();
      htmlLoader.loadString("<html><script language='Javascript'>function testFunc(){alert('test')}</script><body><p>Hello World</p></body></html>");

      htmlLoader.addEventListener("htmlDOMInitialize",htmlDOMInitialize);
      function htmlDOMInitialize(evt){
      trace(evt.target.window); // [object DOMWindow]
      evt.target.window.testFunc(); // TypeError: Error #1006: testFunc is not a function
      }