9 Replies Latest reply on Jan 29, 2009 10:04 PM by aarontwc

    Unable to run flex files in Firefox and Safari

    aarontwc
      I created a flex program that loads an XML document. In short what I did is as follows:

      var XML_URL:String = "data/GetData.aspx?documentId=123";
      var XMLURL:URLRequest = new URLRequest (XML_URL);
      loader = new URLLoader(XMLURL);

      The document loads up perfectly fine ONLY in Internet Explorer, but it does not load up at all in Firefox and Safari.

      I was told it could be some sandbox rules problems. So i tried crossdomain.xml, but that didn't solve the problem either. I believe the problem should be something else.

      I always thought Flex/Flash is suppsoed tobe browser independent. Any ideas?

      Thanks
      Aaron
        • 1. Re: Unable to run flex files in Firefox and Safari
          levancho Level 3
          what protocol are you running your flex app under file or http?
          also , have you tried installing debug version of flashplayer in firefox.
          that way you will know exactly what error is happening, regular flasplayer ignores exceptions, etc ...
          • 2. Re: Unable to run flex files in Firefox and Safari
            aarontwc Level 1
            Hey there,

            I tried install a debug version of flash as you suggested. I got this error from Firefox:

            But I can't understand why this error could be happening because the program works perfectly in IE.

            TypeError: Error #1010: A term is undefined and has no properties.
            at FlexAnnotationProject/annotationsLoaded()
            at FlexAnnotationProject/loadAnnotationEvent()
            at FlexAnnotationProject/__loadAnnotation_result()
            at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
            at flash.events::EventDispatcher/dispatchEvent()
            at mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
            at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()
            at mx.rpc::Responder/result()
            at mx.rpc::AsyncRequest/acknowledge()
            at ::DirectHTTPMessageResponder/completeHandler()
            at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
            at flash.events::EventDispatcher/dispatchEvent()
            at flash.net::URLLoader/flash.net:URLLoader::onComplete()

            Any ideas?

            Aaron
            • 3. Unable to run flex files in Firefox and Safari
              levancho Level 3
              problem is with race condition I beleive

              "A term" This error most commonly occurs when you try to access a property on an undefined item

              somewhere here:
              annotationsLoaded()

              looks like you are trying to access result from service without waiting for its result,it seems that annotationsLoaded is called from some kind of creationComplete event;
              it might work in IE and not work in FF, you need to use result event listener to access a returned data.

              can you post sniper inside of FlexAnnotationProject/annotationsLoaded()
              are you trying to access service result data in that function?
              • 4. Re: Unable to run flex files in Firefox and Safari
                aarontwc Level 1
                Hi Levancho,

                These are some code snippets:

                var XML_URL:String = "data/GetData.aspx?documentId=123";
                var XMLURL:URLRequest = new URLRequest (XML_URL);
                annotationsLoader = new URLLoader(XMLURL);
                annotationsLoader.addEventListener("complete", annotationsLoaded);
                • 5. Re: Unable to run flex files in Firefox and Safari
                  aarontwc Level 1
                  Hi Levancho,

                  These are some code snippets: (as you can see, I did try to add an event listener that calls annotationsLoaded function when it is 'complete'. What method should i be using here instead?

                  var XML_URL:String = "data/GetData.aspx?documentId=123";
                  var XMLURL:URLRequest = new URLRequest (XML_URL);
                  annotationsLoader = new URLLoader(XMLURL);
                  annotationsLoader.addEventListener("complete", annotationsLoaded);

                  private function annotationsLoaded (evtObj:Event):void {
                  try {
                  xmlAnnotations = XML(annotationsLoader.data);
                  lightText.htmlText = xmlAnnotations.document[0].bodyText[0].toString();
                  } catch (error:Error) {
                  Alert.show("There were problems importing the required document.");
                  return;
                  } }

                  Thanks
                  Aaron
                  • 6. Re: Unable to run flex files in Firefox and Safari
                    aarontwc Level 1
                    Anyone with any ideas how this can be possible? Why is the program working in IE and not in Firefox?

                    Thanks
                    Aaron
                    • 7. Re: Unable to run flex files in Firefox and Safari
                      levancho Level 3
                      you can look at this xml data/GetData.aspx?documentId=123
                      in browser and see if its different in IE vs FF.

                      • 8. Re: Unable to run flex files in Firefox and Safari
                        aarontwc Level 1
                        Hi,

                        First of thank you for your constant help! Appreciate it.

                        In any case, there is no difference in the XML file rendered in Firefox and IE. I checked this before actually.

                        The only difference is that in Firefox, this message gets display:
                        This XML file does not appear to have any style information associated with it. The document tree is shown below.

                        Else, the XML file structure is totally similar.

                        Thanks
                        Aaron
                        • 9. Re: Unable to run flex files in Firefox and Safari
                          aarontwc Level 1
                          Hi there, are there any experts who tried using xml to access data documents and run into such problems?

                          Thanks
                          aaron