dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Is there a way to check for an Internet connection?

  1. #1
    Senior Member
    Join Date
    Oct 2000
    Location
    2006: Thika, Kenya
    Posts
    955
    If I have a local Flash file on a laptop, that when connected to the web performs a certain function, but when not the function does not happen, is there a way to detect the connection for this purpose?


  2. #2
    Senior Member
    Join Date
    Mar 2002
    Posts
    298
    As far as I know there's no direct way, but you could cheat by attempting to download a very small file from the web, if it hasn't loaded in, say, 5 seconds then you can assume that the user is not connected at the moment.
    Hopefully Flash7 will throw exceptions so that we can track errors properly

  3. #3
    <<MXian>> memon2k's Avatar
    Join Date
    Nov 2001
    Location
    C:\Program Files\Macromedia\Flash MX
    Posts
    148

    Post

    some 3rd party tools like flashstudio and swfstudio do provide such functionalities to ur projectors where u can check if the computer is connected and its IP address and stuff..
    aLi

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    266
    Be careful.

    Test it more throughly before you purchase. I didnt tried swf studio but the last time I try flash studio it so called connected is only connected to somthing but not necessary internet. It will report connected if your computer is connected to a lan, another computer or even a single hub without other connection. I dont know if they have improved it or not so you better test it yourself.

    Actaully I also want to add this function to my product for long but I cant find a easy way to do so. The best window API is offering is same as what I mentioned above. I decided not to add it as it sometime is misleading. I may add a function to let user to try to connect to HTTP / FTP server and see if it success later.

  5. #5
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food
    Posts
    3,789
    Originally posted by TheOriginalFlashDavo
    If I have a local Flash file on a laptop, that when connected to the web performs a certain function, but when not the function does not happen, is there a way to detect the connection for this purpose?

    create a text file and put it on the web: iTest.txt

    put an empty movieclip somewhere:

    Code:
    //frame 1
    connection = new loadVars();
    connection.load("http://mycompany.com/make_sure/to_use_the/full_path/iTest.txt"};
    connection.onLoad = function() {
         connected = 1;
    }
    Code:
    //frame 5 or somewhere around there
    if (connected) {
         _root.yourFunction();
    } else {
         _root.yourOtherFunction();
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center