FlexTip: XMLSocket connect() after disconnect from server
Tuesday, July 24th, 2007- AS3Tip: Tween in AS3.0 project
- FlexTips
- FlexTip: Preventing CheckBox selection with Key.SPACE
- FlexTip: mx:Text vs. mx:TextArea
- FlexTip: Problem with masks and scalable Flash
- FlexTip: WordWrap for mx:Text
- Useful Flex tips
- FlexTip - Stop displaying Focus
- FlexTip: Add Thumbs to Mx:Slider programatically
- FlexTips: How to add Bitmap to UIComponent
- FlexTip: XMLSocket connect() after disconnect from server
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.
tagged under: flex.Flex Tips





3 Comments
barry.b
• Visit Site
July 24th, 2007
“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
Administrator
• Visit Site
July 24th, 2007
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
adg
• Visit Site
January 22nd, 2008
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
Live Preview
Leave a comment