0 Replies Latest reply on May 28, 2007 8:55 AM by konkivo

    FABridge.flash.root() is null or not an object

    konkivo
      Hello everyone! I'm having a problem with Flex-Ajay Bridge in an aspx page. Days ago I could access flex variables from javascript without problems, but now I can´t. This is my flex code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" height="194" width="374" creationComplete="init()">
      <fab:FABridge xmlns:fab="bridge.*" bridgeName="flash" id="flash"/>


      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      public function init():void
      {
      mx.controls.Alert.show("ready");
      }
      ]]>
      </mx:Script>

      <mx:Label x="227" y="171" text="Probemos......" fontSize="14"/>

      <mx:TextInput x="140" y="27" id="pki"/>
      <mx:TextInput x="140" y="76" id="pkf"/>
      <mx:TextInput x="140" y="122" id="nc"/>
      <mx:Label x="27" y="29" text="PKI" fontSize="14"/>
      <mx:Label x="27" y="78" text="PKF" fontSize="14"/>
      <mx:Label x="27" y="123" text="Max. Carriles" fontSize="14"/>
      </mx:Application>

      It's just some text boxes and labels. I want to access those labels from javascript, so I wrote in my html page this:

      <html xmlns=" http://www.w3.org/1999/xhtml" >
      <head runat="server">
      <title>Inventario de Carriles con Flex</title>

      <script src="JS/FABridge.js"type="text/javascript"></script>
      <script type="text/javascript" language="javascript">

      function setMessage()
      {
      var flexApp = FABridge.flash.root();
      alert("1");
      alert("2");
      flexApp.pki().setText("1");
      flexApp.pkf().setText("2");
      flexApp.nc().setText("3");
      }
      </script>
      </head>
      <body>
      <form id="form1" runat="server">
      <div>
      <table>
      <tr>
      <td>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="374" height="194" >
      <param name="movie" value="FlexApp\Inventario.swf"/>
      <param name="quality" value="high"/> <
      <embed src="FlexApp\Inventario.swf" width="374" height="194" align="middle" quality="high" pluginspage=" http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
      </object>
      </td> (...............)

      When I click in the button, the js fuction starts executing but when it tries to initialize the flexApp variable it shows an error: flexApp.flash.root() is null or not an object.......... can you please help me? I tried everything and didn't manage to solve this problem, I know that the flex .swf is initialized but I don't know why the javascript can't access it :(

      Does someone knows what can I do in order to solve this???

      Thanks!!!

      Regards,

      Mariana