2 Replies Latest reply on Dec 3, 2007 2:42 PM by Tikis_Mikis

    Flex/AMFPHP App NOT working in IE but works in FireFox...

    Tikis_Mikis
      Hello I am beginning to develop Flex applications. I am working with PHP in a Symfony environment.

      The error below was appearing before in FireFox but disappeared after I uninstalled the Flash Player plugin and reinstalled the Flash debug player for FireFox. I also uninstalled the IE Flash Player and replaced it with the Flash debug player for IE (i believe it comes with Active X). I have the exact same version of Flash player for both browsers, 0.0.47.0). This is the error:

      [object RemotingConnection]
      Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion
      at sample/initApplication()
      at sample/___Application1_creationComplete()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/set initialized()
      at mx.managers::LayoutManager/::doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/::callLaterDispatcher2()
      at mx.core::UIComponent/::callLaterDispatcher()

      Again this error was appearing in FF before but now ONLY on IE. The same error arrises if I try to open the SWF file localed in the bin/ directory in the Flex project. My flex project is located on my Desktop and the server I am trying to connect to is on a Linux box. AGAIN, this project displays the data perfectly on FF but NOT on IE. It just displays several rows from a DB table in a datagrid in Flex.

      I have no idea how to approach this! Here is my ".mxml" file:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="initApplication()">
      <mx:DataGrid dataProvider="{phpData}">
      <mx:columns>
      <mx:DataGridColumn headerText="User ID" dataField="userid"/>
      <mx:DataGridColumn headerText="User Name" dataField="username"/>
      <mx:DataGridColumn headerText="Email Address" dataField="emailaddress"/>
      </mx:columns>
      </mx:DataGrid>
      <mx:Script>
      <![CDATA[
      [Bindable]
      public var phpData:Array;

      import flash.net.Responder;

      public var gateway:RemotingConnection;

      public function initApplication():void
      {
      gateway = new RemotingConnection(" http://project_dev_environment/web/backend_dev.php/gateway/amfphp");
      gateway.call("Sample.getUsers", new Responder(onResult, onFault));
      }

      public function onResult(result:Array):void
      {
      trace(phpData);
      phpData = result;
      }


      public function onFault(fault:String):void
      {
      trace(fault);
      }
      ]]>
      </mx:Script>
      </mx:Application>

      Here is the required ".as" file:

      package
      {
      import flash.net.NetConnection;
      import flash.net.ObjectEncoding;

      public class RemotingConnection extends NetConnection
      {
      public function RemotingConnection(sURL:String)
      {
      objectEncoding = ObjectEncoding.AMF0;

      if (sURL) {
      connect(sURL);
      }
      }

      public function AppendToGatewayUrl(s:String):void
      {

      }
      }
      }

      I have given a differnt URL because this is an internal application and wont be accessible by outside users.

      Again, this app works when loaded on FF but not IE! HELP please I have been trying to figure this out since 7 am this morning and I'm desperate!

      Just FYI AMFPHP is set up correctly, although its version 1.2 - could this be causing problems?

      Please, PLEASE help me! or at least a hint. Thank you!
        • 1. Re: Flex/AMFPHP App NOT working in IE but works in FireFox...
          Garyl Woolworth Level 1
          Hey Tikis,

          There are a few factors that could be throwing this thing through a loop. I've had this exact same thing happen to me once before and the culprit for me was that my crossdomain.xml file wasn't 100% perfectly formed. Apparently Firefox didn't care enough and went on with it's life however IE decided it wasn't going to read it and I received that error, so that would be the first thing I would check.

          The next thing is what version of PHP are you running on the server, it seems to me that the newest release of 5.2.2 is throwing this error more often then ever before, something I might suggest is upgrading to AMFPHP 1.9. RemoteObjects natively send data in what's called the AMF3 format which is much speedier then it's predecessor of AMF0. Only AMFPHP 1.9 has the ability to receive / send the data back in AMF3 format, where as with the 1.2 version it's sending the call, converts it down to AMF0 sends the data (at a slower pace) and generates a result. The other advantage to being able to use AMF3 is having true type casted results such as if PHP returns a number you can check it by if(event.result == 0) where as AMF0 everything is converted into a string and then sent back to Flash / Flex. So aside from all of these advantages the last one is less code, you no longer need to use the RemotingConnection to convert everything down to AMF0. I would make a copy of amfphp on your linux of the 1.9 version and send the remote object at that first and see what happens, if you are still receiving the same error then the problem lies in something else.

          Hope this helps.
          • 2. Re: Flex/AMFPHP App NOT working in IE but works in FireFox...
            Tikis_Mikis Level 1
            Hello! I fount out what the problem was! I was not logged in to the system in IE and so the request would not be processed lol...sorry for the incovenience and thank you for your very informative post! Im running PHP 5