Be a Supporter!

As3 Test If Connected To Internet

  • 835 Views
  • 6 Replies
New Topic Respond to this Topic
IndigenousDigitalist
IndigenousDigitalist
  • Member since: Sep. 24, 2010
  • Offline.
Forum Stats
Member
Level 13
Game Developer
As3 Test If Connected To Internet 2012-11-05 19:08:32 Reply

So I have a game that loads data from a database online. I want to have an error message show up on screen if the user isn't connected to the internet (it's not going to be online, just so you don't think I'm being silly). I know you'll get an error in the output saying the URL couldn't be loaded, but I want an error actually on the stage. I have a movieClip and I have it set to spawn when you're not connected, I just need to know how to check if you're connected. Thanks in advance


BBS Signature
milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to As3 Test If Connected To Internet 2012-11-05 19:15:17 Reply

see what Events are dispatched and when

Max-Vador
Max-Vador
  • Member since: Nov. 12, 2005
  • Offline.
Forum Stats
Member
Level 13
Animator
Response to As3 Test If Connected To Internet 2012-11-05 20:11:51 Reply

i'm guessing you're running some type of fetch command.

just put a small file at the url you're linking to and if the fetch fails then display the error

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to As3 Test If Connected To Internet 2012-11-05 20:18:40 Reply

At 11/5/12 08:11 PM, Max-Vador wrote: just put a small file at the url you're linking to and if the fetch fails then display the error

or use Events and listen for errors while connecting to the database.
unless the particular library you're using doesn't support that type of event. Then just have a URLLoader like Max said.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Sandremss128
Sandremss128
  • Member since: Aug. 22, 2009
  • Offline.
Forum Stats
Supporter
Level 11
Programmer
Response to As3 Test If Connected To Internet 2012-11-06 06:08:13 Reply

How are people going to load your flash without internet? :/

Sam
Sam
  • Member since: Oct. 1, 2005
  • Offline.
Forum Stats
Moderator
Level 19
Programmer
Response to As3 Test If Connected To Internet 2012-11-06 08:50:25 Reply

At 11/6/12 06:08 AM, Sandremss128 wrote: How are people going to load your flash without internet? :/

They could download the SWF. It's also a case of if multiple connections to the database is needed. If a connection is made once, there's no guarantee a second connection can be opened. What if the players internet connection drops whilst playing the game?

Max-Vador
Max-Vador
  • Member since: Nov. 12, 2005
  • Offline.
Forum Stats
Member
Level 13
Animator
Response to As3 Test If Connected To Internet 2012-11-06 09:12:43 Reply

At 11/6/12 06:08 AM, Sandremss128 wrote: How are people going to load your flash without internet? :/

:---(it's not going to be online, just so you don't think I'm being silly)