FlexTip: XMLSocket connect() after disconnect from server
Utorok, Júl 24th, 2007Table of contents for flex-tips
- FlexTips
- FlexTip: mx:Text vs. mx:TextArea
- FlexTip: XMLSocket connect() after disconnect from server
- FlexTip: Problem with masks and scalable Flash
- FlexTips: How to add Bitmap to UIComponent
- FlexTip – Stop displaying Focus
- FlexTip: Preventing CheckBox selection with Key.SPACE
- FlexTip: WordWrap for mx:Text
- FlexTip: Add Thumbs to Mx:Slider programatically
- AS3 Conditional Breakpoint – enterDebugger()
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.
3 Comments
barry.b
• Visit Site
Júl 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
Júl 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
Január 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
Sorry, comments for this entry are closed at this time.