Replies: 2 comments 7 replies
-
You should use NetworkInfo ANE from Distriqt to check reachability. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Please, is there any solution to this problem? My content is downloaded in full without any profits |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Welcome, everyone
I hope you all have a nice day
I have a somewhat strange problem and I don't know the cause yet. I have been trying to solve it for a week and have not found a solution yet.
The problem: The loss of Internet connection is not checked within the application, and the application remains convinced that there is an Internet connection, and thus it causes me losses in that it displays content that is supposed to appear in the presence of the Internet, but it shows it even if there is no Internet connection.
More clearly, it is assumed that there is a movie clip called (errordia) and it is located above the content that will appear with the Internet in the application. If there is Internet, the movie clip (errordia) will disappear, and if there is no Internet connection, the movie clip (errordia) will continue to appear above the content until it opens. Internet user.
I wrote more than one code, and each time the code works very successfully on the Android system and there are no problems. If there is Internet, the movie clip (errordia) disappears and the user can watch the content. If he closes the Internet, the movie clip (errordia)appears at the same moment above the content and there are no problems, but the problem is in the system. (IOS SYSTEM ) It is very difficult and caused me psychological distress for a week and I did not find a solution. Because it is not working properly. Whereas, if the user opens the application for the first time and there is an Internet connection, the movie clip (errordia) disappears correctly, and this is good. But when the user turns off the Internet while he is still inside the application, it is supposed that the movie clip (errordia) appears again because the Internet connection has been lost, but this does not happen while the movie clip continues to disappear as if the phone is connected to the Internet!!!!! The user watches paid content for free
I don't know how this is, knowing that the same code works correctly on the Android system
Knowing that the code works correctly only once on the (IOS) system, since if the user opens the application for the first time while he is not connected to the Internet, he will see the movie clip (errordia) above the content, and this is a beautiful thing, so it turns on the Internet so that the movie clip (errordia) disappears, and indeed it disappears when verified. There is Internet, but if the user turns off the Internet again, the movie clip (errordia) will continue to disappear, haha, and I do not know how, and this is a problem.
I will show you more than one example that I tried differently but with the same result. I hope to find a solution or a specific code to solve the problem
first code :
`import flash.net.URLLoader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.MovieClip;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onCompleteLoading);
loader.addEventListener(IOErrorEvent.IO_ERROR, onErrorLoading);
loader.load(new URLRequest("https://www.google.com"));
;
function onCompleteLoading(e:Event):void
{
}
function onErrorLoading(e:IOErrorEvent):void
{
errordia.visible= true;
}`
second code :
`import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.IOErrorEvent;
var internetCheckTimer:Timer = new Timer(1000);
internetCheckTimer.addEventListener(TimerEvent.TIMER, checkInternetConnection);
internetCheckTimer.start();
function checkInternetConnection(event:TimerEvent):void {
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, onCompleteLoading);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
urlLoader.load(new URLRequest("https://www.google.com"));
}
errordia.visible = true;
var isInternetAvailable:Boolean = false;
function handleIOError(event:IOErrorEvent):void {
}
function onCompleteLoading(e:Event):void {
}
function showHideElements():void {
errordia.visible = !isInternetAvailable;
}
stage.addEventListener(Event.ACTIVATE, clearCache);
function clearCache(event:Event):void {
internetCheckTimer.stop();
internetCheckTimer.reset();
}`
Video to illustrate the problem :
problem.internet.ios.mp4
Beta Was this translation helpful? Give feedback.
All reactions