5 Replies Latest reply on Apr 25, 2006 12:36 PM by Newsgroup_User

    Flash Remoting Not working from browser

    Level 7
      First off sorry for the multiple post, only just noticed this forum..
      anyway...

      Quick Problem:

      I have a movie that connects and displays the data fine when run by testing
      the movie from within flash its fine however as soon as i try to run it from
      the html or by IIS link to the swf, or even by browsing to the swf via file
      manager it fails to connect.

      Any ideas why?


      Thanks,
      Koop.





      Full Description:

      My code was connecting fine before or at least i think it was.
      Does anyone have a basic fla that works for them using the methods below
      that i could test on my machine?

      the connection code is as follows:


      code =============
      import mx.remoting.*;

      function Result()
      {
      //receives data returned from the method
      this.onResult = function(result)
      {
      trace("Data received from server : " + result + result.items.length + "
      items were received" );
      //this is where we put the data in the text field
      for (i=0;i<results.items.length;i++){

      dataField.text = dataField.text + result.items.length;
      }
      dataField.text = dataField.text + result.items.length;
      }

      this.onStatus = function(error)
      {
      trace("Error : " + error.description);
      dataField.text = "Error : " + error.description;
      }
      }

      NetServices.setDefaultGatewayUrl("<mygatewayurl>");
      var gw = NetServices.createGatewayConnection();
      var server = gw.getService("flashservices.gateway.interaction", new
      Result());
      server.getLatestNews();

      end code ================

      A few things have flagged in my mind, they may be way off track however;
      - Recent security changes in browsers (click here to activate...)
      - My wildcard import on the first line however i'm not sure which
      dependancies i specifically need to compile this project.
      - cross domain security restrictions.. i am currently connecting to a
      service at a remote server from my local machine/IIS

      what confuses me is that good ol' CTRL+ENTER works fine but obviously fails
      on any parameter calls such as loading "newsitem.swf?theID=<variableID>"
      which requires that it be run via a webserver.

      Any help would be appreciated.
      Koop.



        • 1. Re: Flash Remoting Not working from browser
          Level 7
          I think i've narrowed it down to a security based error. I tried uploading
          it all to the domain that it would eventually be hosted at and it seemed to
          work..

          Does anyone know how the movies manage to work when testing but fail upon
          correct loading? Does flash load the swf in some other way when testing?

          Koop.

          "Koop" <koop@o2.nsm> wrote in message
          news:e1uhj2$q6m$1@forums.macromedia.com...
          > First off sorry for the multiple post, only just noticed this forum..
          > anyway...
          >
          > Quick Problem:
          >
          > I have a movie that connects and displays the data fine when run by
          > testing
          > the movie from within flash its fine however as soon as i try to run it
          > from
          > the html or by IIS link to the swf, or even by browsing to the swf via
          > file
          > manager it fails to connect.
          >
          > Any ideas why?
          >
          >
          > Thanks,
          > Koop.
          >
          >
          >
          >
          >
          > Full Description:
          >
          > My code was connecting fine before or at least i think it was.
          > Does anyone have a basic fla that works for them using the methods below
          > that i could test on my machine?
          >
          > the connection code is as follows:
          >
          >
          > code =============
          > import mx.remoting.*;
          >
          > function Result()
          > {
          > //receives data returned from the method
          > this.onResult = function(result)
          > {
          > trace("Data received from server : " + result + result.items.length + "
          > items were received" );
          > //this is where we put the data in the text field
          > for (i=0;i<results.items.length;i++){
          >
          > dataField.text = dataField.text + result.items.length;
          > }
          > dataField.text = dataField.text + result.items.length;
          > }
          >
          > this.onStatus = function(error)
          > {
          > trace("Error : " + error.description);
          > dataField.text = "Error : " + error.description;
          > }
          > }
          >
          > NetServices.setDefaultGatewayUrl("<mygatewayurl>");
          > var gw = NetServices.createGatewayConnection();
          > var server = gw.getService("flashservices.gateway.interaction", new
          > Result());
          > server.getLatestNews();
          >
          > end code ================
          >
          > A few things have flagged in my mind, they may be way off track however;
          > - Recent security changes in browsers (click here to activate...)
          > - My wildcard import on the first line however i'm not sure which
          > dependancies i specifically need to compile this project.
          > - cross domain security restrictions.. i am currently connecting to a
          > service at a remote server from my local machine/IIS
          >
          > what confuses me is that good ol' CTRL+ENTER works fine but obviously
          > fails
          > on any parameter calls such as loading "newsitem.swf?theID=<variableID>"
          > which requires that it be run via a webserver.
          >
          > Any help would be appreciated.
          > Koop.
          >
          >
          >


          • 2. Re: Flash Remoting Not working from browser
            Level 7
            Depends on what you have in AS. But in general if you are doing data
            communcations, you need http:// protocol outside of the Flash Authoring
            environment. You cannot use file:///C:/.... Issues such as Flash movie
            running locally with data comm that sends data to server script are blocked.
            You may want a local testing server to avoid efficiency loss due to
            uploading for production run testing.

            --
            Lon Hosford
            www.lonhosford.com
            May many happy bits flow your way!
            "Koop" <koop@o2.nsm> wrote in message
            news:e1uql9$6cp$1@forums.macromedia.com...
            I think i've narrowed it down to a security based error. I tried uploading
            it all to the domain that it would eventually be hosted at and it seemed to
            work..

            Does anyone know how the movies manage to work when testing but fail upon
            correct loading? Does flash load the swf in some other way when testing?

            Koop.

            "Koop" <koop@o2.nsm> wrote in message
            news:e1uhj2$q6m$1@forums.macromedia.com...
            > First off sorry for the multiple post, only just noticed this forum..
            > anyway...
            >
            > Quick Problem:
            >
            > I have a movie that connects and displays the data fine when run by
            > testing
            > the movie from within flash its fine however as soon as i try to run it
            > from
            > the html or by IIS link to the swf, or even by browsing to the swf via
            > file
            > manager it fails to connect.
            >
            > Any ideas why?
            >
            >
            > Thanks,
            > Koop.
            >
            >
            >
            >
            >
            > Full Description:
            >
            > My code was connecting fine before or at least i think it was.
            > Does anyone have a basic fla that works for them using the methods below
            > that i could test on my machine?
            >
            > the connection code is as follows:
            >
            >
            > code =============
            > import mx.remoting.*;
            >
            > function Result()
            > {
            > //receives data returned from the method
            > this.onResult = function(result)
            > {
            > trace("Data received from server : " + result + result.items.length + "
            > items were received" );
            > //this is where we put the data in the text field
            > for (i=0;i<results.items.length;i++){
            >
            > dataField.text = dataField.text + result.items.length;
            > }
            > dataField.text = dataField.text + result.items.length;
            > }
            >
            > this.onStatus = function(error)
            > {
            > trace("Error : " + error.description);
            > dataField.text = "Error : " + error.description;
            > }
            > }
            >
            > NetServices.setDefaultGatewayUrl("<mygatewayurl>");
            > var gw = NetServices.createGatewayConnection();
            > var server = gw.getService("flashservices.gateway.interaction", new
            > Result());
            > server.getLatestNews();
            >
            > end code ================
            >
            > A few things have flagged in my mind, they may be way off track however;
            > - Recent security changes in browsers (click here to activate...)
            > - My wildcard import on the first line however i'm not sure which
            > dependancies i specifically need to compile this project.
            > - cross domain security restrictions.. i am currently connecting to a
            > service at a remote server from my local machine/IIS
            >
            > what confuses me is that good ol' CTRL+ENTER works fine but obviously
            > fails
            > on any parameter calls such as loading "newsitem.swf?theID=<variableID>"
            > which requires that it be run via a webserver.
            >
            > Any help would be appreciated.
            > Koop.
            >
            >
            >

            • 3. Re: Flash Remoting Not working from browser
              Level 7
              Thank you for your feedback, i have now set up a testing server senario to
              ensure that this does not cause any trouble.. I am still however uploading
              to the test server from dreamweaver on each change, I'm sure i can do this
              better, I'll look into this.

              Many thanks
              Koop.


              • 4. Re: Flash Remoting Not working from browser
                Level 7
                In DW you can set the site settings so it knows where you testing server is
                located and DW will preview by linking to that server for you and including
                the http://. See "Testing Server" under Sites->Manage Sites.

                You will need to your site folders inside the local test server folders:
                See "Testing Server Folder". You set the testing server URL to that: See
                "URL Prefix".

                This is all a part of the DW features to allow you to test and debug server
                side scripted applications within DW before moving them to production.

                ----------------------------------
                I do not use it however just to test Flash movies.

                If I have no reason to change the Flash movie HTML (or server script), I do
                not have DW open to reduce overhead in the computer. What I do is have a
                browser window open and load the Flash HTML (or script) document using the
                http:// in that and just hit refresh after I publish. One problem you can
                run into with that however is if your local cache setting do not refresh the
                swf, then you need to tweak the caching choice or close and reopen the web
                browser.


                --
                Lon Hosford
                www.lonhosford.com
                May many happy bits flow your way!
                "Koop" <koop@o2.nsm> wrote in message
                news:e20mva$fpi$1@forums.macromedia.com...
                Thank you for your feedback, i have now set up a testing server senario to
                ensure that this does not cause any trouble.. I am still however uploading
                to the test server from dreamweaver on each change, I'm sure i can do this
                better, I'll look into this.

                Many thanks
                Koop.


                • 5. Re: Flash Remoting Not working from browser
                  Level 7
                  Thanks for all the extra info you have offered.
                  I had found that testing flash dynamic sites was just plain awkward, but i
                  will put this into play and see if it helps.

                  Thank you,
                  Koop