FlexTips - XMLSocket connect() after disconnect from server

July 24th, 2007 at 08:40am Administrator

Flexets Forum - learn Flex / AIR / Flash / ActionScript

If you're new here, you may want to subscribe to my RSS feed. If you like my site, consider linking back. I prefer text "Free Flash Tutorials" to http://www.franto.com
Thanks for visiting my site! If you need anything just contacting through Contact page

Here is another Flex tips I came across in our project. I don’t know if this was in AS2.0 as well, but in AS3.0 when you receive event that XMLSocket is disconnected (server is disconnected, your net connection is broken), you can’t call xmlsocket.connect() immediately, but you have to wait for a while. So add there Timer(), or call it with function callLater(). It seems it must be called on next frame. I will not upload any example, because I don’t have running test XML server, but I think it is clear what you have to do.

Let me know, if you have similar issue in your projects.

AddThis Feed Button

Entry Filed under: , , , , ,


Do you want to receive fresh news from my site?
Subscribe to my RSS

»Related posts:



3 Responses to “FlexTips - XMLSocket connect() after disconnect from server”

  1. 1
    barry.b Says:

    “It seems it must be called on next frame. ”

    Frame? you’ve thrown me there. I don’t come to Flex with a Flash background. I actually don’t think in Frames for Flex at all even though I know the final outcome is a swf.

    how do I know when the “next frame” is to make the call? if I use callLater(), that should automatically kick in when it’s ready, yes?

    many thanks

  2. 2
    Administrator Says:

    Ok, you’re right, there are no frames. I call it “frame” because of good old flash, but you’re right, it means when it is ready.

    callLater() works, we have it in our project, and it works

  3. 3
    adg Says:

    do you now if it is perfectly possible to have a flex app in a browser that works with a server that goes down from time to time?
    (supposing you can code your client app so that it takes care of it)

    do you need to use xmlsockets?
    does it work with flex/livecycle data services:
    thus do the remoteobject, dataservice,… things also work?

    adg

Leave a Reply