# Can as3 detect an internet connection?

**URL:** <https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604>\
**Category:** Uncategorized\
**Created:** [July 10, 2008, 5:24pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604 "2008-07-10T17:24:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [July 10, 2008, 5:24pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/1 "2008-07-10T17:24:44Z")

</div>

is it possable for as3 to detect an internet connection?

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [July 10, 2008, 5:52pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/2 "2008-07-10T17:52:26Z")

</div>

[flash.net](http://www.kirupa.com/forum/package-detail.html) package has a read-only property called connect

i did this and it returned true for me

trace(this.connected=true);

---

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [July 10, 2008, 7:15pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/3 "2008-07-10T19:15:45Z")

</div>

by using _trace(this.connected=true);_ doesnt that set the value to true?

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [July 10, 2008, 7:23pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/4 "2008-07-10T19:23:11Z")

</div>

sorry, more like  
trace(this.connected==true);  
typo mate,  
and upon checking it it does work

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [July 10, 2008, 7:33pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/5 "2008-07-10T19:33:40Z")

</div>

I strongly doubt that has anything to do with internet connection…

Where are you seeing that info from [flash.net](http://flash.net) package? Can you link to some adobe info where it says that corresponds to ‘viable internetconnection’ ?

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [July 10, 2008, 9:23pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/6 "2008-07-10T21:23:07Z")

</div>

[quote=sekasi;2356429]I strongly doubt that has anything to do with internet connection…

Where are you seeing that info from [flash.net](http://flash.net) package? Can you link to some adobe info where it says that corresponds to ‘viable internetconnection’ ?[/quote]

…he’s right  
but if you can send a NetworkConnection that mean your connected, this is something i’ll have to look into more, cause now im very interested.

---

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [July 10, 2008, 10:00pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/7 "2008-07-10T22:00:14Z")

</div>

I was thinking about trying to load a text document from a website as my “conection test” if it loads the txt then obviously there is a connection, if not then no. I have no problem doing that but, i dont wana send a url request each time my app starts. just a simple t / f would be suffice for what im doing.

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [July 11, 2008, 8:01am UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/8 "2008-07-11T08:01:53Z")

</div>

[QUOTE=GrndMasterFlash;2356358][flash.net](http://www.kirupa.com/forum/package-detail.html) package has a read-only property called connect

i did this and it returned true for me

trace(this.connected=true);[/QUOTE]

Actually…

> [@AS3 Documentation](#):
>
> Indicates whether Flash Player is connected to a server through a persistent RTMP connection (true) or not (false). When connected through HTTP, this property is false, except when connected to Flash Remoting services on an application server, in which case it is true.

Amarghosh asks a good question. You can’t access remote servers from local files with the standalone player, and if it’s on your server, why do you need to check?

[QUOTE=amarghosh;2356714]even if the network is available, can an swf on the local file system access network?  
i thought it will throw security sandbox errors;

and if it is on the network, y do u wanna check, as the site wouldn’t have loaded at the first place;[/QUOTE]

---

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [July 15, 2008, 5:49pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/9 "2008-07-15T17:49:08Z")

</div>

im working on a screen saver actualy and i want to detect if a web connection is available. if it is i can connect to my xml file if its not ill have a default movie play.

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [July 15, 2008, 6:03pm UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/10 "2008-07-15T18:03:35Z")

</div>

Just go ahead and attempt to load the XML, if the load fails for any reason - internet connection or otherwise - play the default movie.

---

<div class="post-metadata">

**Author:** ![dthought](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dthought/32/3573_2.png) [@dthought](https://forum.kirupa.com/u/dthought)\
**Post date:** [July 16, 2008, 11:25am UTC](https://forum.kirupa.com/t/can-as3-detect-an-internet-connection/265604/11 "2008-07-16T11:25:24Z")

</div>

I remember trying an example from Adobe’s AS3 help that loaded a remote image (some flowers I think it was?) in… from my local computer. However, this was within the Flash IDE - I hadn’t tested it stand-alone. Not sure what that says about the security sandbox 😉
