4 Replies Latest reply on Sep 26, 2006 9:54 AM by Smitchmor

    FLEX and Javascript

      Hello All,

      I am new to FLEX and i was trying to integrate flex with javascript.

      Here is my .swf code :
      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      import flash.external.*;
      public function myFunc():Number {
      return 42;
      public function initApp():void {

      And here is the HTML code that has the javascript and the embedded .swf file
      <SCRIPT language='JavaScript' charset='utf-8'>
      function callApp() {
      var x = worldcup.myFlexFunction();
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="755" height="400" id="worldcup">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="src" value="c:\jsSample.swf" />
      <embed src="c:\jsSample.swf" quality="high" bgcolor="#ffffff" width="755" height="400" name="worldcup" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />
      <button onclick="callApp()">Call App</button>

      But when i click the button on the HTML, i get a javascript error.

      Could anyone please help. i would really appreciate your help.